Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed Jan 26, 2023
1 parent 486c59e commit 0ef7fb5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/unittests/web/sortedstats/sortedstats_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def test_cache_key_is_correct(self):
cache_key = views.get_cache_key(view, timeframe, rows)
self.assertEqual(cache_key, expected_cache_key)

@patch('nav.web.sortedstats.views.cache')
@patch('nav.web.sortedstats.views.get_cache')
def test_process_form_returns_cache_value_if_cache_exists(self, cache_mock):
data = "cached"
cache_mock.get.return_value.data = data
cache_mock.return_value.get.return_value.data = data
fake_form = MagicMock()
fake_form.cleaned_data = {
'view': 'uptime',
Expand All @@ -42,12 +42,12 @@ def test_process_form_returns_cache_value_if_cache_exists(self, cache_mock):
self.assertEqual(result.data, data)

@patch('nav.web.sortedstats.views.collect_result')
@patch('nav.web.sortedstats.views.cache')
@patch('nav.web.sortedstats.views.get_cache')
def test_cache_not_used_if_empty_and_use_cache_is_on(
self, cache_mock, collect_mock
):
data = "new"
cache_mock.get.return_value.data = ""
cache_mock.return_value.get.return_value.data = ""
collect_mock.return_value.data = data
fake_form = MagicMock()
fake_form.cleaned_data = {
Expand All @@ -61,12 +61,12 @@ def test_cache_not_used_if_empty_and_use_cache_is_on(
self.assertEqual(result.data, data)

@patch('nav.web.sortedstats.views.collect_result')
@patch('nav.web.sortedstats.views.cache')
@patch('nav.web.sortedstats.views.get_cache')
def test_cache_not_used_if_empty_and_use_cache_is_off(
self, cache_mock, collect_mock
):
data = "new"
cache_mock.get.return_value.data = ""
cache_mock.return_value.get.return_value.data = ""
collect_mock.return_value.data = data
fake_form = MagicMock()
fake_form.cleaned_data = {
Expand Down

0 comments on commit 0ef7fb5

Please sign in to comment.