From 7f7ec0b85ccf4babec9b8ed1c197384d46ac4c17 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 20 Mar 2024 10:23:55 +0545 Subject: [PATCH] fix: Use the newer version of the initialize() function --- tests/test_orgs.py | 21 +++++++++------------ tests/test_projects.py | 6 +++--- tests/test_tasks.py | 6 +++--- tests/test_users.py | 8 ++++---- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/tests/test_orgs.py b/tests/test_orgs.py index 8351b99..5740805 100755 --- a/tests/test_orgs.py +++ b/tests/test_orgs.py @@ -26,15 +26,14 @@ from sys import argv # from tm_admin.organizations.organizations_proto import OrganizationsMessage #from tm_admin.yamlfile import YamlFile -from tm_admin.organizations.organizations import OrganizationsDB from tm_admin.organizations.organizations_class import OrganizationsTable from tm_admin.organizations.api import OrganizationsAPI -from tm_admin.users.api import UsersAPI -from tm_admin.projects.api import ProjectsAPI from tm_admin.types_tm import Organizationtype, Userrole from datetime import datetime import asyncio from codetiming import Timer +import tm_admin +import test_users # Instantiate logger log = logging.getLogger(__name__) @@ -46,8 +45,9 @@ # database, the other for tm_admin. organizations = OrganizationsAPI() -users = UsersAPI() -projects = ProjectsAPI() +users = tm_admin.users.api.UsersAPI() +projects = tm_admin.projects.api.ProjectsAPI() +tasks = tm_admin.tasks.api.TasksAPI() async def create_organisations(): # new_organisation_dto: NewOrganisationDTO) -> int: @@ -185,15 +185,12 @@ async def main(): datefmt="%y-%m-%d %H:%M:%S", stream=sys.stdout, ) - - # FIXME: this assumes there is some user data to query - await users.initialize(args.uri) - - # FIXME: this assumes there is some project data to query - await projects.initialize(args.uri) - await organizations.initialize(args.uri) await create_organisations() + + await projects.initialize(args.uri) + await users.initialize(args.uri) + await tasks.initialize(args.uri) await get_organisation_by_id() await get_organisation_by_name() diff --git a/tests/test_projects.py b/tests/test_projects.py index fc1b555..ccc0ad8 100755 --- a/tests/test_projects.py +++ b/tests/test_projects.py @@ -511,9 +511,9 @@ async def main(): # await tasks.getTypes("tasks") # teams = tm_admin.teams.api.TeamsAPI() - await projects.initialize(args.uri, users, tasks) - await users.initialize(args.uri, projects, tasks) - await tasks.initialize(args.uri, projects, users) + await projects.initialize(args.uri) + await users.initialize(args.uri) + await tasks.initialize(args.uri) # await teams.initialize(args.uri, projects) # The API for this class also requires access to other tables diff --git a/tests/test_tasks.py b/tests/test_tasks.py index 84ab304..2dd6014 100755 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -310,9 +310,9 @@ async def main(): stream=sys.stdout, ) - await projects.initialize(args.uri, users, tasks) - await users.initialize(args.uri, projects, tasks) - await tasks.initialize(args.uri, projects, users) + await projects.initialize(args.uri) + await users.initialize(args.uri) + await tasks.initialize(args.uri) # These populate the database for testing await create_tasks(tasks) diff --git a/tests/test_users.py b/tests/test_users.py index 8379d06..a0492bf 100755 --- a/tests/test_users.py +++ b/tests/test_users.py @@ -189,7 +189,7 @@ async def UsersQueriesUsernameFilterAPI(): page = 2 username= "rob" # FIXME: this works fine with real data, but not with the small - # testdata we create. + # testdata we create.a # result = await users.getFilterUsers(username, page) # print(result) # result = await users.getFilterUsers(username, page) @@ -552,9 +552,9 @@ async def main(): ) tasks = tm_admin.tasks.api.TasksAPI() - projects = tm_admin.projects.api.ProjectsAPI() - await projects.initialize(args.uri, users, tasks) - await users.initialize(args.uri, projects, tasks) + # projects = tm_admin.projects.api.ProjectsAPI() + # await projects.initialize(args.uri, users, tasks) + await users.initialize(args.uri) # Populate the table with test data await create_users(users)