Files
ActiveCollabAPI/integration_tests/test_Integration_AcLogin.py
T
2024-02-24 17:42:26 +00:00

28 lines
989 B
Python

import json
from pprint import pprint
from unittest import TestCase
from ActiveCollabAPI.ActiveCollab import ActiveCollab
with open("test-config.json", "r") as cfg:
config = json.load(cfg)
class Test_Integration_Login(TestCase):
def test_login_success(self):
ac = ActiveCollab(config["base_url"])
session = ac.login_to_first_account(config["username"], config["password"])
self.assertEqual(config["first_name"], session.user.first_name)
self.assertEqual(config["last_name"], session.user.last_name)
self.assertEqual(1, len(session.accounts))
self.assertGreater(len(session.token.token), 5)
def test_get_projects(self):
ac = ActiveCollab(config["base_url"])
ac.login_to_first_account(config["username"], config["password"])
projects = ac.get_projects()
self.assertGreater(len(projects), 0)
self.assertEqual('Project', projects[0].class_)
self.assertGreater(projects[0].id, 0)