Skip to content

Commit

Permalink
jsonpreview can_preview test
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Nov 14, 2012
1 parent d6a34da commit 1b54710
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Empty file.
40 changes: 40 additions & 0 deletions ckanext/jsonpreview/tests/test_preview.py
@@ -0,0 +1,40 @@
from ckan import plugins
import ckan.tests as tests
import ckanext.jsonpreview.plugin as previewplugin


class TestMyPlugin(tests.TestCase):

@classmethod
def setup_class(cls):
plugins.load('json_preview')

cls.p = previewplugin.JsonPreview()

@classmethod
def teardown_class(cls):
plugins.reset()

def test_can_preview(self):
data_dict = {
'resource': {
'format': 'jsonp'
}
}
assert self.p.can_preview(data_dict)

data_dict = {
'resource': {
'format': 'json',
'on_same_domain': True
}
}
assert self.p.can_preview(data_dict)

data_dict = {
'resource': {
'format': 'json',
'on_same_domain': True
}
}
assert not self.p.can_preview(data_dict)

0 comments on commit 1b54710

Please sign in to comment.