From 7e8ae6b33254eedd5c6dbfecbffc9a9827a2d038 Mon Sep 17 00:00:00 2001 From: Martin Lessmeister Date: Thu, 8 Aug 2019 11:25:58 -0400 Subject: [PATCH] fix stats controller tests --- browse/controllers/stats_page/tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/browse/controllers/stats_page/tests.py b/browse/controllers/stats_page/tests.py index a4d37e99c..7797f8898 100644 --- a/browse/controllers/stats_page/tests.py +++ b/browse/controllers/stats_page/tests.py @@ -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() @@ -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.')