Skip to content

Commit

Permalink
add more items to cleared cache
Browse files Browse the repository at this point in the history
  • Loading branch information
artoonie committed Jul 28, 2024
1 parent 3f14ab8 commit 72b819b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
9 changes: 8 additions & 1 deletion common/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ def purge_vis_cache(cls, slug):
reverse('visualizeEmbedly', args=(slug, 'barchart-interactive')),
reverse('visualizeEmbedly', args=(slug, 'sankey')),
reverse('visualizeEmbedly', args=(slug, 'table')),
reverse('visualizeBallotpedia', args=(slug,))
reverse('visualizeBallotpedia', args=(slug,)),
reverse('visualizeEmbedded', args=(slug,)) + '?vistype=barchart-interactive',
reverse('visualizeEmbedded', args=(slug,)) + '?vistype=barchart-fixed',
reverse('visualizeEmbedded', args=(slug,)) + '?vistype=tabular-by-candidate',
reverse('visualizeEmbedded', args=(slug,)) + '?vistype=tabular-by-round',
reverse('visualizeEmbedded', args=(slug,)) + '?vistype=tabular-by-round-interactive',
reverse('visualizeEmbedded', args=(slug,)) + '?vistype=candidate-by-round',
reverse('visualizeEmbedded', args=(slug,)) + '?vistype=sankey'
]
cls.purge_paths_cache(paths)

Expand Down
18 changes: 16 additions & 2 deletions visualizer/tests/testSimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def test_cloudflare_purge(self, requestPostResponse):
slug = TestHelpers.get_latest_upload().slug

requestPostResponse.side_effect = TestHelpers.create_request_mock({'a': 0}, 200)
expectedLogString = "INFO:common.cloudflare:Cleared cloudflare cache for 8 starting with "\
expectedLogString = "INFO:common.cloudflare:Cleared cloudflare cache for 15 starting with "\
"/v/city-of-eastpointe-macomb-county-mi: {'a': 0}"

with self.settings(
Expand All @@ -397,14 +397,28 @@ def test_cloudflare_purge(self, requestPostResponse):
"https://example.com/vo/city-of-eastpointe-macomb-county-mi/sankey",
"https://example.com/vo/city-of-eastpointe-macomb-county-mi/table",
"https://example.com/vb/city-of-eastpointe-macomb-county-mi",
"https://example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=barchart-interactive",
"https://example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=barchart-fixed",
"https://example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=tabular-by-candidate",
"https://example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=tabular-by-round",
"https://example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=tabular-by-round-interactive",
"https://example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=candidate-by-round",
"https://example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=sankey",
"https://www.example.com/v/city-of-eastpointe-macomb-county-mi",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi",
"https://www.example.com/vo/city-of-eastpointe-macomb-county-mi",
"https://www.example.com/vo/city-of-eastpointe-macomb-county-mi/bar",
"https://www.example.com/vo/city-of-eastpointe-macomb-county-mi/barchart-interactive",
"https://www.example.com/vo/city-of-eastpointe-macomb-county-mi/sankey",
"https://www.example.com/vo/city-of-eastpointe-macomb-county-mi/table",
"https://www.example.com/vb/city-of-eastpointe-macomb-county-mi"]}
"https://www.example.com/vb/city-of-eastpointe-macomb-county-mi",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=barchart-interactive",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=barchart-fixed",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=tabular-by-candidate",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=tabular-by-round",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=tabular-by-round-interactive",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=candidate-by-round",
"https://www.example.com/ve/city-of-eastpointe-macomb-county-mi?vistype=sankey"]}
requestPostResponse.assert_called_with(expectedUrl,
headers=expectedHeaders,
data=json.dumps(expectedData),
Expand Down

0 comments on commit 72b819b

Please sign in to comment.