Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
fix: Use the newer version of the initialize() function
Browse files Browse the repository at this point in the history
  • Loading branch information
robsavoye committed Mar 20, 2024
1 parent c2db5d5 commit 7f7ec0b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
21 changes: 9 additions & 12 deletions tests/test_orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -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:
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7f7ec0b

Please sign in to comment.