Skip to content

Commit

Permalink
fix stats controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mhl10 committed Aug 8, 2019
1 parent b8135ba commit 7e8ae6b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions browse/controllers/stats_page/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,14 @@ def test_get_download_stats_csv(self, mock_get_monthly_download_stats) -> None:
self.assertEqual(code, status.HTTP_200_OK, 'Response should be OK.')
self.assertEqual(response_data['csv'], expected_response)

@mock.patch('browse.controllers.stats_page.get_document_count_by_yymm')
@mock.patch('browse.controllers.stats_page.get_monthly_submission_count')
def test_get_monthly_submissions_page(self, mock_get_monthly_submission_count) -> None: # type: ignore
def test_get_monthly_submissions_page(self,
mock_get_monthly_submission_count,
mock_get_document_count_by_yymm) -> None: # type: ignore
"""Tests for :func:`.get_monthly_submissions_page`."""
# test basic response
mock_get_document_count_by_yymm.return_value = 0
mock_get_monthly_submission_count.return_value = (0, 0)
response_data, code, headers = \
stats_page.get_monthly_submissions_page()
Expand Down Expand Up @@ -177,10 +181,14 @@ def test_get_monthly_submissions_page(self, mock_get_monthly_submission_count) -
self.assertIsInstance(response_data['current_dt'], datetime)
self.assertIsInstance(response_data['arxiv_start_dt'], datetime)

@mock.patch('browse.controllers.stats_page.get_document_count_by_yymm')
@mock.patch('browse.controllers.stats_page.get_monthly_submission_stats')
def test_get_submission_stats_csv(self, mock_get_monthly_submission_stats) -> None: # type: ignore
def test_get_submission_stats_csv(self,
mock_get_monthly_submission_stats,
mock_get_document_count_by_yymm) -> None: # type: ignore
"""Tests for :func:`.get_submission_stats_csv`."""
# test basic response
mock_get_document_count_by_yymm.return_value = 0
mock_get_monthly_submission_stats.return_value = list()
response_data, code, headers = stats_page.get_submission_stats_csv()
self.assertEqual(code, status.HTTP_200_OK, 'Response should be OK.')
Expand Down

0 comments on commit 7e8ae6b

Please sign in to comment.