Skip to content

Test failure: TestTagDataFile.test_reindex_tag_files_admin #95

Description

@jhanarato

Failing test 1 of 3:

___________________________________________________________________________________________________________________________________________________________________ TestTagDataFile.test_reindex_tag_files_admin ___________________________________________________________________________________________________________________________________________________________________

self = <app.tests.api.api_v1.test_tags.TestTagDataFile object at 0x72a316cb7cb0>, mock_search = <MagicMock name='search' id='126044769863920'>, mock_yield = <MagicMock name='yield_file_path' id='126044767176416'>, mock_get_current_user_admin = None, mock_is_admin_or_superuser_is_active = None
user = UserBase(github_id=1, username='test', email='test@test.com', avatar_url='https://avatars.githubusercontent.com/u/123?v=4', role='administrator'), async_client = <httpx.AsyncClient object at 0x72a315bbd640>

    @pytest.mark.asyncio
    @patch("app.api.api_v1.endpoints.tags.yield_file_path")
    @patch("app.api.api_v1.endpoints.tags.search")
    async def test_reindex_tag_files_admin(
        self, mock_search, mock_yield, mock_get_current_user_admin, mock_is_admin_or_superuser_is_active, user, async_client
    ):
        """Admin can reindex all tag files."""
        mock_file1 = Path("/app/checkouts/unpublished/tag/pli/ms/sutta/sn/sn1/sn1.1_tag.json")
        mock_file2 = Path("/app/checkouts/unpublished/tag/pli/ms/sutta/sn/sn1/sn1.2_tag.json")
        mock_yield.return_value = [mock_file1, mock_file2]
        mock_search.add_to_index.return_value = (True, None)
    
        response = await async_client.post("/tags/reindex/")
    
        assert response.status_code == status.HTTP_200_OK
>       assert response.json()["indexed"] == 2
E       assert 0 == 2

app/tests/api/api_v1/test_tags.py:289: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions