From a5187836b1c43a6697ada5d09d4910680a3cf23e Mon Sep 17 00:00:00 2001 From: oskvr37 Date: Sun, 29 Dec 2024 22:28:04 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/__init__.py | 0 tests/test_api.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_api.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_api.py b/tests/test_api.py new file mode 100644 index 0000000..6595bed --- /dev/null +++ b/tests/test_api.py @@ -0,0 +1,34 @@ +import unittest + +from tiddl.config import Config +from tiddl.api import TidalApi + + +class TestApi(unittest.TestCase): + api: TidalApi + + def setUp(self): + config = Config() + auth = config.config["auth"] + + token, user_id, country_code = ( + auth.get("token"), + auth.get("user_id"), + auth.get("country_code"), + ) + + assert token, "No token found in config file" + assert user_id, "No user_id found in config file" + assert country_code, "No country_code found in config file" + + self.api = TidalApi(token, user_id, country_code) + + def test_ready(self): + session = self.api.getSession() + + self.assertEqual(session["userId"], int(self.api.user_id)) + self.assertEqual(session["countryCode"], self.api.country_code) + + +if __name__ == "__main__": + unittest.main()