Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: clickable summaries #1451

Merged
merged 3 commits into from
Dec 13, 2024

Merge branch 'release-0.2.0' into feat/kevin-1391

5b65e4a
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

feat: clickable summaries #1451

Merge branch 'release-0.2.0' into feat/kevin-1391
5b65e4a
Select commit
Loading
Failed to load commit list.
GitHub Actions / Backend Test Results succeeded Dec 12, 2024 in 0s

2 fail, 491 pass in 1m 47s

493 tests  ±0   491 ✅ ±0   1m 47s ⏱️ -1s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     2 ❌ ±0 

Results for commit 5b65e4a. ± Comparison against earlier commit 4cb7fe3.

Annotations

Check warning on line 0 in lcfs.tests.internal_comment.test_internal_comment

See this annotation in the file changed.

@github-actions github-actions / Backend Test Results

test_get_internal_comments_multiple_comments (lcfs.tests.internal_comment.test_internal_comment) failed

backend/pytest-results.xml [took 0s]
Raw output
assert 0 == 3
 +  where 0 = len([])
client = <httpx.AsyncClient object at 0x7f851eb46860>
fastapi_app = <fastapi.applications.FastAPI object at 0x7f851dc246a0>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7f851e6d8040>
add_models = <function add_models.<locals>._add at 0x7f851dfb4040>

    @pytest.mark.anyio
    async def test_get_internal_comments_multiple_comments(
        client: AsyncClient,
        fastapi_app: FastAPI,
        set_mock_user,
        add_models,
    ):
        """
        Test retrieving multiple internal comments for an entity.
        """
        set_mock_user(
            fastapi_app, [RoleEnum.GOVERNMENT], user_details={"username": "IDIRUSER"}
        )
    
        transfer = Transfer(
            transfer_id=5,
            from_organization_id=1,
            to_organization_id=2,
            agreement_date=datetime.now(),
            transaction_effective_date=datetime.now(),
            price_per_unit=1.0,
            quantity=100,
            transfer_category_id=1,
            current_status_id=1,
            recommendation=TransferRecommendationEnum.Record,
            effective_status=True,
        )
        await add_models([transfer])
    
        comments = []
        for i in range(3):
            internal_comment = InternalComment(
                internal_comment_id=i,
                comment=f"Comment {i}",
                audience_scope=AudienceScopeEnum.ANALYST.value,
                create_user="IDIRUSER",
            )
            await add_models([internal_comment])
            association = TransferInternalComment(
                transfer_id=transfer.transfer_id,
                internal_comment_id=internal_comment.internal_comment_id,
            )
            await add_models([association])
            comments.append(internal_comment)
    
        entity_type = EntityTypeEnum.TRANSFER.value
        entity_id = transfer.transfer_id
        url = fastapi_app.url_path_for(
            "get_comments", entity_type=entity_type, entity_id=entity_id
        )
        response = await client.get(url)
    
        assert response.status_code == status.HTTP_200_OK
        data = response.json()
    
        assert isinstance(data, list)
>       assert len(data) == 3
E       assert 0 == 3
E        +  where 0 = len([])

lcfs/tests/internal_comment/test_internal_comment.py:364: AssertionError

Check warning on line 0 in lcfs.tests.user.test_user_views

See this annotation in the file changed.

@github-actions github-actions / Backend Test Results

test_get_user_activities_as_manage_users_same_org (lcfs.tests.user.test_user_views) failed

backend/pytest-results.xml [took 0s]
Raw output
assert 403 == 200
 +  where 403 = <Response [403 Forbidden]>.status_code
 +  and   200 = status.HTTP_200_OK
client = <httpx.AsyncClient object at 0x7f851de2fd30>
fastapi_app = <fastapi.applications.FastAPI object at 0x7f851e573f70>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7f851f9e70a0>
add_models = <function add_models.<locals>._add at 0x7f851d1efb50>

    @pytest.mark.anyio
    async def test_get_user_activities_as_manage_users_same_org(
        client: AsyncClient,
        fastapi_app: FastAPI,
        set_mock_user,
        add_models,
    ):
        # Mock the current user as a user with MANAGE_USERS
        set_mock_user(fastapi_app, [RoleEnum.MANAGE_USERS])
    
        # Assuming target user with user_profile_id=3 exists and is in organization_id=1
        target_user_id = 1
    
        # Create activity history records for the target user
        transfer = Transfer(
            transfer_id=1,
            from_organization_id=1,
            to_organization_id=2,
            agreement_date=datetime.strptime("2024-01-01", "%Y-%m-%d"),
            transaction_effective_date=datetime.strptime("2024-01-01", "%Y-%m-%d"),
            price_per_unit=1.0,
            quantity=10,
            transfer_category_id=1,
            current_status_id=1,
            recommendation=TransferRecommendationEnum.Record,
            effective_status=True,
        )
        transfer_history = TransferHistory(
            transfer_history_id=1,
            transfer_id=transfer.transfer_id,
            transfer_status_id=3,  # Sent
            user_profile_id=target_user_id,
        )
    
        await add_models(
            [
                transfer,
                transfer_history,
            ]
        )
    
        # Prepare request data
        pagination = {
            "page": 1,
            "size": 10,
            "filters": [],
            "sortOrders": [],
        }
    
        # Send request to get user activities
        url = fastapi_app.url_path_for("get_user_activities", user_id=target_user_id)
        response = await client.post(url, json=pagination)
    
>       assert response.status_code == status.HTTP_200_OK
E       assert 403 == 200
E        +  where 403 = <Response [403 Forbidden]>.status_code
E        +  and   200 = status.HTTP_200_OK

lcfs/tests/user/test_user_views.py:173: AssertionError