add tests

This commit is contained in:
oskvr37
2024-12-29 22:28:04 +01:00
parent 28af0ef8ee
commit a5187836b1
2 changed files with 34 additions and 0 deletions
View File
+34
View File
@@ -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()