Skip to content

Commit

Permalink
tests for audio_preview
Browse files Browse the repository at this point in the history
  • Loading branch information
calexandr committed Nov 27, 2019
1 parent 557b7e0 commit c62a2d5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Empty file.
33 changes: 33 additions & 0 deletions ckanext/audioview/tests/test_view.py
@@ -0,0 +1,33 @@
# encoding: utf-8

from ckan.lib.helpers import url_for

import ckan.plugins as p

from nose.tools import assert_true
from ckan.tests import helpers, factories


class TestAudioView(helpers.FunctionalTestBase):
_load_plugins = ['audio_view', 'image_view']

@helpers.change_config('ckan.views.default_views', '')
def test_view_shown_on_resource_page_with_audio_url(self):
app = self._get_test_app()

dataset = factories.Dataset()

resource = factories.Resource(package_id=dataset['id'],
format='wav')

resource_view = factories.ResourceView(
resource_id=resource['id'],
view_type='audio_view',
audio_url='http://example.wav')

url = url_for('resource.read',
id=dataset['name'], resource_id=resource['id'])

response = app.get(url)

assert_true(resource_view['audio_url'] in response)

0 comments on commit c62a2d5

Please sign in to comment.