Fixed a unit test.

This commit is contained in:
Michael Lazar
2016-07-22 22:42:51 -07:00
parent f88ede9c14
commit aa29415fe1
2 changed files with 206 additions and 201 deletions

View File

@@ -266,18 +266,18 @@ def test_submission_urlview(submission_page, terminal, refresh_token):
# Positive Case
data = submission_page.content.get(submission_page.nav.absolute_index)
TEST_BODY = 'test comment body'
data['body'] = TEST_BODY
data['body'] = 'test comment body'
with mock.patch.object(terminal, 'open_urlview') as open_urlview, \
mock.patch('subprocess.Popen'):
submission_page.controller.trigger('b')
open_urlview.assert_called_with(TEST_BODY)
open_urlview.assert_called_with('test comment body')
# Negative Case
data = submission_page.content.get(submission_page.nav.absolute_index)
TEST_NO_BODY = ''
data['body'] = TEST_NO_BODY
data['text'] = ''
data['body'] = ''
data['url_full'] = 'http://test.url.com'
with mock.patch.object(terminal, 'open_urlview') as open_urlview, \
mock.patch('subprocess.Popen'):
submission_page.controller.trigger('b')
assert not open_urlview.called
open_urlview.assert_called_with('http://test.url.com')