Skip to content

Commit

Permalink
fixes last test
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Apr 20, 2023
1 parent ddf966e commit 8a637dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from models_library.projects import ProjectID
from models_library.projects_state import ProjectStatus
from models_library.users import UserID
from models_library.utils.fastapi_encoders import jsonable_encoder
from pydantic import parse_obj_as
from servicelib.aiohttp.long_running_tasks.server import TaskProgress
from servicelib.json_serialization import json_dumps
Expand Down Expand Up @@ -204,8 +205,8 @@ async def create_project(

# 3. save new project in DB
new_project = await db.insert_project(
new_project,
user_id,
project=jsonable_encoder(new_project),
user_id=user_id,
product_name=product_name,
force_as_template=as_template,
hidden=copy_data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ async def insert_project(
:raises ValidationError
:return: inserted project
"""

# pylint: disable=no-value-for-parameter
async with self.engine.acquire() as conn:
# TODO: check security of this query with args. Hard-code values?
Expand All @@ -133,9 +134,9 @@ async def insert_project(
insert_values = convert_to_db_names(project)
insert_values.update(
{
"type": ProjectType.TEMPLATE
"type": ProjectType.TEMPLATE.value
if (force_as_template or user_id is None)
else ProjectType.STANDARD,
else ProjectType.STANDARD.value,
"prj_owner": user_id if user_id else None,
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async def _request_get(client, pid) -> dict:
return project


async def _request_update(client, project, pid):
async def _request_replace(client, project, pid):
# PUT /v0/projects/{project_id}
url = client.app.router["replace_project"].url_for(project_id=pid)
resp = await client.put(url, json=project)
Expand All @@ -207,6 +207,7 @@ async def _request_delete(client, pid):
await assert_status(resp, web.HTTPNoContent)


@pytest.mark.testit
@pytest.mark.parametrize("user_role", [UserRole.USER])
async def test_workflow(
postgres_db: sa.engine.Engine,
Expand Down Expand Up @@ -272,7 +273,7 @@ async def test_workflow(
)
# modify
pid = modified_project["uuid"]
await _request_update(client, modified_project, pid)
await _request_replace(client, modified_project, pid)

# list not empty
projects = await _request_list(client)
Expand Down

0 comments on commit 8a637dd

Please sign in to comment.