Skip to content

Commit

Permalink
properly test number of calls
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Nov 8, 2012
1 parent d87c115 commit 600ac9f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ckan/tests/functional/test_preview_interface.py
Expand Up @@ -75,17 +75,19 @@ def test_hook(self):
assert 'mock-preview' in result.body
assert 'mock-preview.js' in result.body

assert self.plugin.calls['can_preview'] == 1, plugin.call
assert self.plugin.calls['setup_template_variables'] == 1, plugin.calls
assert self.plugin.calls['preview_templates'] == 1, plugin.calls
assert self.plugin.calls['can_preview'] == 1, self.plugin.calls
assert self.plugin.calls['setup_template_variables'] == 1, self.plugin.calls
assert self.plugin.calls['preview_templates'] == 1, self.plugin.calls

preview_url = h.url_for(controller='package',
action='resource_datapreview',
id=testpackage.id,
resource_id=testpackage.resources[1].id)
result = self.app.get(preview_url, status=200)

assert 'mock-preview' not in result.body, result.body
assert 'mock-preview.js' not in result.body, result.body
assert 'mock-json-preview' in result.body
assert 'mock-json-preview.js' in result.body

assert self.plugin.calls['can_preview'] == 2, self.plugin.calls
assert self.plugin.calls['setup_template_variables'] == 1, self.plugin.calls
assert self.plugin.calls['preview_templates'] == 1, self.plugin.calls

0 comments on commit 600ac9f

Please sign in to comment.