Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
Test for rerun params.
  • Loading branch information
teleyinex committed Aug 7, 2018
1 parent d8f6bd0 commit 24b20ef
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/test_jobs/test_webhooks.py
Expand Up @@ -58,6 +58,25 @@ def test_webhooks(self, mock):
assert webhook('url', self.webhook_payload), err_msg
err_msg = "The post method should be called"
assert mock.called, err_msg
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
mock.assert_called_with('url', params=dict(),
data=json.dumps(self.webhook_payload),
headers=headers)


@with_context
@patch('pybossa.jobs.requests.post')
def test_webhooks_rerun(self, mock):
"""Test WEBHOOK rerun works."""
mock.return_value = FakeResponse(text=json.dumps(dict(foo='bar')),
status_code=200)
assert webhook('url', self.webhook_payload, rerun=True), err_msg
err_msg = "The post method should be called"
assert mock.called, err_msg
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
mock.assert_called_with('url', params=dict(rerun=True),
data=json.dumps(self.webhook_payload),
headers=headers)

@with_context
@patch('pybossa.jobs.requests.post')
Expand Down

0 comments on commit 24b20ef

Please sign in to comment.