Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Rosenberg authored and Jake Rosenberg committed Oct 3, 2023
1 parent aa9ebbb commit 1799748
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/portal/apps/site_search/api/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def mock_cms_search(mocker):
yield mocked_fn


@pytest.fixture
def mock_service_account(mocker):
yield mocker.patch('portal.apps.site_search.api.views.service_account', autospec=True)


@pytest.fixture
def mock_files_search(mocker):
mocked_fn = mocker.patch('portal.apps.site_search.api.views.files_search')
Expand Down Expand Up @@ -76,7 +81,7 @@ def test_search_with_auth(regular_user, client, mock_cms_search,
'include': True}}


def test_search_no_auth(client, mock_cms_search, mock_files_search):
def test_search_no_auth(client, mock_cms_search, mock_files_search, mock_service_account):
response = client.get('/api/site-search/?page=0&query_string=test')

assert response.json() == {
Expand All @@ -93,7 +98,7 @@ def test_search_no_auth(client, mock_cms_search, mock_files_search):


def test_search_public(client, configure_public, mock_cms_search,
mock_files_search):
mock_files_search, mock_service_account):
response = client.get('/api/site-search/?page=0&query_string=test')

assert response.json() == {
Expand Down

0 comments on commit 1799748

Please sign in to comment.