def test_get_unique_profiles(graphql_request): num_profiles = graphql_request("getUniqueProfiles") assert num_profiles > 0 def test_workspace_event_log(graphql_request, company_schema): log = graphql_request("eventLog", {"workspaceId": company_schema}) assert len(log["items"]) > 0 assert len(log["items"]) <= log["length"] def test_workspace_event_log_limit_offset(graphql_request, company_schema): offset = 3 limit = 10 log = graphql_request( "eventLog", {"workspaceId": company_schema, "offset": offset, "limit": limit} ) assert len(log["items"]) <= limit assert log["offset"] == offset def test_workspace_event_log_for_collection( graphql_request, company_schema, merch_collection_id ): log = graphql_request( "eventLog", {"workspaceId": company_schema, "collectionId": merch_collection_id} ) assert len(log["items"]) > 0 assert all(entry["collectionId"] == merch_collection_id for entry in log["items"]) def test_all_workspaces(graphql_request): workspaces = graphql_request("allWorkspaces") assert len(workspaces) >= 1 def test_get_workspace(graphql_request, company_schema, email): workspace = graphql_request("workspace", {"workspaceId": company_schema}) assert workspace["id"] == company_schema assert workspace["name"] is not None assert workspace["createdBy"] is not None assert workspace["createdBy"]["email"] == email assert workspace["createdBy"]["me"] is True def test_get_workspace_total_profiles(graphql_request, company_schema): total_profiles = graphql_request( "totalProfiles", {"workspaceId": company_schema}, type_name="Workspace" ) assert isinstance(total_profiles, int) assert total_profiles > 0 def test_update_workspace(graphql_request, workspace_schema, random_string): random_name = f"TestWorkspace2-{random_string}" random_description = f"TestWorkspace2-Description-{random_string}" workspace = graphql_request( "updateWorkspace", { "workspaceId": workspace_schema, "name": random_name, "description": random_description, }, ) assert workspace["id"] == workspace_schema assert workspace["name"] == random_name assert workspace["description"] == random_description def test_create_and_delete_workspace(graphql_request, random_string): random_name = f"TestWorkspace-{random_string}" random_description = f"TestWorkspace-Description-{random_string}" workspace = graphql_request( "createWorkspace", {"name": random_name, "description": random_description} ) workspace_id = workspace["id"] assert workspace["name"] == random_name assert workspace["description"] == random_description deleted_workspace = graphql_request( "deleteWorkspace", {"workspaceId": workspace_id, "acceptedConsequences": []} ) # TODO must return full workspace according to the Schema? assert deleted_workspace is not None assert deleted_workspace["id"] == workspace_id assert deleted_workspace["status"] == "deleted"