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

Commit

Permalink
fix: Add test for creating a table class and inserting it into the table
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Mar 4, 2024
1 parent d98401e commit 8caf943
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
12 changes: 12 additions & 0 deletions tests/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
# user = UsersDB()
messages = MessagesAPI()

async def create_message():
project_id = 1
# log.debug(f"--- create_message() unimplemented!")
msg = MessagesTable(message="Hello World!",
subject="test",
project_id=project_id,
from_user_id=0,
to_user_id=1
)
result = await messages.create(msg)

async def get_all_messages():
log.debug(f"--- get_all_messages() unimplemented!")
# user_id: int,
Expand Down Expand Up @@ -211,6 +222,7 @@ async def main():

# await user.connect(args.uri)
await messages.initialize(args.uri)
await create_message()

await send_welcome_message()
await send_message_after_validation()
Expand Down
19 changes: 15 additions & 4 deletions tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
from sys import argv
# from tm_admin.users.users_proto import UsersMessage
#from tm_admin.yamlfile import YamlFile
from tm_admin.users.users import UsersDB
from tm_admin.projects.projects import ProjectsDB
# from tm_admin.users.users import UsersDB
# from tm_admin.projects.projects import ProjectsDB
from tm_admin.types_tm import Userrole, Mappinglevel, Taskstatus
from datetime import datetime
from tm_admin.users.users_class import UsersTable
from tm_admin.tasks.tasks_class import TasksTable
from tm_admin.tasks.api import TasksAPI
import asyncio
from codetiming import Timer
Expand All @@ -46,6 +46,16 @@
# FIXME: For now these tests assume you have a local postgres installed. One has the TM
# database, the other for tm_admin.

async def create_task():
project_id = 1
log.debug(f"--- create_task() unimplemented!")
task = TasksTable(project_id=1,
project_task_name="testing, 1,2,3",
is_square="false",
task_status=Taskstatus.READY,
)
result = await tasks.create(task)

async def get_task():
log.debug(f"--- get_task() unimplemented!")
task_id = 1
Expand Down Expand Up @@ -208,7 +218,8 @@ async def main():

# user = UsersDB(args.uri)
# task = TasksDB(args.uri)
await tasks.connect(args.uri)
await tasks.initialize(args.uri)
await create_task()
# project = ProjectsDB(args.uri)

await get_task()
Expand Down

0 comments on commit 8caf943

Please sign in to comment.