Spaces:
Running
Running
| import pytest | |
| from app.projects.repositories.collaboration_repository import CollaborationRepository | |
| from app.projects.services.collaboration_service import CollaborationService | |
| async def test_collaboration_team_lifecycle(db_session): | |
| repo = CollaborationRepository(db_session) | |
| service = CollaborationService(repo) | |
| workspace_id = "test_workspace" | |
| # 1. Create Team | |
| team = await service.create_team(workspace_id, "Engineering") | |
| assert team.name == "Engineering" | |
| # 2. List Teams | |
| teams = await service.list_teams(workspace_id) | |
| assert len(teams) >= 1 | |
| # 3. Update Team | |
| updated = await service.update_team(workspace_id, team.id, "Product") | |
| assert updated.name == "Product" | |
| # 4. Archive | |
| await service.archive_team(workspace_id, team.id) | |
| teams = await service.list_teams(workspace_id) | |
| assert not any(t.id == team.id for t in teams) | |
| async def test_collaboration_invitation_lifecycle(db_session): | |
| repo = CollaborationRepository(db_session) | |
| service = CollaborationService(repo) | |
| workspace_id = "test_workspace" | |
| email = "test@example.com" | |
| # Test invitation | |
| invitation = await service.invite_member(workspace_id, email, "member") | |
| assert invitation.email == email | |
| assert hasattr(invitation, "token") # Check if token is returned | |