async def user_project(client, fake_project, logged_user):
    async with NewProject(
        fake_project, client.app, user_id=logged_user["id"]
    ) as project:
        print("-----> added project", project["name"])
        yield project
        print("<----- removed project", project["name"])
Exemple #2
0
async def template_project(
    client,
    fake_project,
    logged_user,
    all_group: Dict[str, str],
    tests_data_dir: Path,
):
    project_data = deepcopy(fake_project)
    project_data["name"] = "Fake template"
    project_data["uuid"] = "d4d0eca3-d210-4db6-84f9-63670b07176b"
    project_data["accessRights"] = {
        str(all_group["gid"]): {
            "read": True,
            "write": False,
            "delete": False
        }
    }

    async with NewProject(
            project_data,
            client.app,
            user_id=None,
            clear_all=True,
            tests_data_dir=tests_data_dir,
    ) as template_project:
        print("-----> added template project", template_project["name"])
        yield template_project
        print("<----- removed template project", template_project["name"])
Exemple #3
0
async def empty_user_project2(client, empty_project, logged_user):
    project = empty_project()
    async with NewProject(project, client.app,
                          user_id=logged_user["id"]) as project:
        print("-----> added project", project["name"])
        yield project
        print("<----- removed project", project["name"])
Exemple #4
0
async def shared_project(
    client,
    fake_project,
    logged_user,
    all_group,
    tests_data_dir: Path,
):
    fake_project.update(
        {
            "accessRights": {
                f"{all_group['gid']}": {
                    "read": True,
                    "write": False,
                    "delete": False
                }
            },
        }, )
    async with NewProject(
            fake_project,
            client.app,
            user_id=logged_user["id"],
            tests_data_dir=tests_data_dir,
    ) as project:
        print("-----> added project", project["name"])
        yield project
        print("<----- removed project", project["name"])
Exemple #5
0
async def user_project(client, fake_project: Dict, logged_user: Dict,
                       project_id: ProjectID) -> AsyncIterator[Dict]:
    fake_project["prjOwner"] = logged_user["name"]
    fake_project["uuid"] = f"{project_id}"

    async with NewProject(fake_project, client.app,
                          user_id=logged_user["id"]) as project:
        yield project
async def unpublished_project(client, fake_project):
    project_data = deepcopy(fake_project)
    project_data["name"] = "Template Unpublished project"
    project_data["uuid"] = "b134a337-a74f-40ff-a127-b36a1ccbede6"
    project_data["published"] = False

    async with NewProject(
        project_data, client.app, user_id=None, clear_all=True
    ) as template_project:
        yield template_project
async def published_project(client, fake_project) -> Dict:
    project_data = deepcopy(fake_project)
    project_data["name"] = "Published project"
    project_data["uuid"] = SHARED_STUDY_UUID
    project_data["published"] = True

    async with NewProject(
        project_data, client.app, user_id=None, clear_all=True
    ) as template_project:
        yield template_project
async def empty_user_project2(
    client,
    empty_project,
    logged_user,
    tests_data_dir: Path,
) -> Dict[str, Any]:
    project = empty_project()
    async with NewProject(
        project, client.app, user_id=logged_user["id"], tests_data_dir=tests_data_dir
    ) as project:
        print("-----> added project", project["name"])
        yield project
        print("<----- removed project", project["name"])
Exemple #9
0
async def user_project(
    client,
    fake_project,
    logged_user,
    tests_data_dir: Path,
):
    async with NewProject(
            fake_project,
            client.app,
            user_id=logged_user["id"],
            tests_data_dir=tests_data_dir,
    ) as project:
        print("-----> added project", project["name"])
        yield project
        print("<----- removed project", project["name"])
Exemple #10
0
async def user_project(
    client: TestClient, fake_project: ProjectDict, user_id
) -> AsyncIterator[ProjectDict]:
    # pylint: disable=no-value-for-parameter

    async with NewProject(fake_project, client.app, user_id=user_id) as project:

        yield project

        # cleanup repos
        engine = client.app[APP_DB_ENGINE_KEY]
        async with engine.acquire() as conn:

            # cascade deletes everything except projects_vc_snapshot
            await conn.execute(projects_vc_repos.delete())
            await conn.execute(projects_vc_snapshots.delete())
Exemple #11
0
async def user_project(client, mock_project: Dict, logged_user: Dict) -> Dict:
    mock_project["prjOwner"] = logged_user["name"]

    async with NewProject(mock_project, client.app,
                          user_id=logged_user["id"]) as project:
        yield project