ytmusicapi/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
sigma67 527fed67ff
get_watch_playlist: add shuffle and radio parameters (closes #282)
removed get_watch_playlist_shuffle in favor of the new shuffle parameter to get_watch_playlist
setting the radio parameter now properly randomizes the watch playlist, as discussed in #282
2022-10-01 15:36:22 +02:00
..
README.rst Update tests README 2020-05-21 20:43:24 +02:00
test.cfg.example test_get_library_playlists: add limit to cfg 2022-09-29 21:11:56 +02:00
test.py get_watch_playlist: add shuffle and radio parameters (closes #282) 2022-10-01 15:36:22 +02:00

Package tests
============================================
Tests use the ``unittest`` framework. Each function has a corresponding unittest.
Sometimes there is a single unittest for multiple functions to ensure there are no permanent changes in the user's YouTube account (i.e. subscribe and unsubscribe).

Note that there must be a ``headers_auth.json`` in the `tests` folder to run authenticated tests.
For testing the song upload, there also needs to be a file with the name specified in the code in the project root.

Copy ``tests/test.cfg.example`` to ``tests/test.cfg`` to run the tests. The entry descriptions should be self-explanatory.
For the headers_raw, you need to indent the overflowing lines with a tab character. For the upload test you need a suitable music file in the test directory.
Adjust the file to contain appropriate information for your YouTube account and local setup.

Coverage badge
--------------
Make sure you installed the dev requirements as explained in `CONTRIBUTING.rst <https://github.com/sigma67/ytmusicapi/blob/master/CONTRIBUTING.rst>`_. Run

.. code-block:: bash

    cd tests
    coverage run -m unittest test.py


to generate a coverage report.