Skip to content

Commit

Permalink
[#3229] Fix url_for test
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Apr 11, 2017
1 parent f5eb025 commit 605febf
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions ckanext/datapusher/tests/test_action.py
Expand Up @@ -13,6 +13,9 @@ class TestDataPusherAction(object):

@classmethod
def setup_class(cls):

cls.app = helpers._get_test_app()

if not p.plugin_loaded('datastore'):
p.load('datastore')
if not p.plugin_loaded('datapusher'):
Expand Down Expand Up @@ -288,12 +291,15 @@ def submit(res, user):

user = factories.User()
res = factories.Resource(user=user)
with mock.patch('requests.post') as r_mock:
r_mock().json = mock.Mock(
side_effect=lambda: dict.fromkeys(
['job_id', 'job_key']))
r_mock.reset_mock()
submit(res, user)
submit(res, user)

eq_(1, r_mock.call_count)

with self.app.flask_app.test_request_context():
with mock.patch('requests.post') as r_mock:
r_mock().json = mock.Mock(
side_effect=lambda: dict.fromkeys(
['job_id', 'job_key']))
r_mock.reset_mock()

submit(res, user)
submit(res, user)

eq_(1, r_mock.call_count)

0 comments on commit 605febf

Please sign in to comment.