Skip to content

Commit

Permalink
fix tests, mock and patch with flash messages
Browse files Browse the repository at this point in the history
  • Loading branch information
therealmarv committed Jan 5, 2017
1 parent fca795c commit 5e08b9f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def test_handle_content_type_html_error(self, mockjsonify,
@patch('pybossa.util.request')
@patch('pybossa.util.render_template')
@patch('pybossa.util.jsonify')
def test_redirect_content_type_json(self, mockjsonify, mockrender, mockrequest):
@patch('pybossa.util.last_flashed_message')
def test_redirect_content_type_json(self, mocklast, mockjsonify, mockrender, mockrequest):
mockrequest.headers.__getitem__.return_value = 'application/json'
mockjsonify.side_effect = myjsonify
res = util.redirect_content_type('http://next.uri')
Expand All @@ -227,7 +228,8 @@ def test_redirect_content_type_json(self, mockjsonify, mockrender, mockrequest):
@patch('pybossa.util.request')
@patch('pybossa.util.render_template')
@patch('pybossa.util.jsonify')
def test_redirect_content_type_json_message(self, mockjsonify, mockrender, mockrequest):
@patch('pybossa.util.last_flashed_message')
def test_redirect_content_type_json_message(self, mocklast, mockjsonify, mockrender, mockrequest):
mockrequest.headers.__getitem__.return_value = 'application/json'
mockjsonify.side_effect = myjsonify
res = util.redirect_content_type('http://next.uri', message='hallo123')
Expand Down

0 comments on commit 5e08b9f

Please sign in to comment.