Added tests for the open_link method.
This commit is contained in:
@@ -264,20 +264,19 @@ def test_submission_urlview(submission_page, terminal, refresh_token):
|
||||
submission_page.config.refresh_token = refresh_token
|
||||
submission_page.oauth.authorize()
|
||||
|
||||
# Positive Case
|
||||
# Submission case
|
||||
data = submission_page.content.get(submission_page.nav.absolute_index)
|
||||
data['body'] = 'test comment 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 comment body')
|
||||
open_urlview.assert_called_with('test comment body ❤')
|
||||
|
||||
# Negative Case
|
||||
# Subreddit case
|
||||
data = submission_page.content.get(submission_page.nav.absolute_index)
|
||||
data['text'] = ''
|
||||
data['body'] = ''
|
||||
data['url_full'] = 'http://test.url.com'
|
||||
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')
|
||||
open_urlview.assert_called_with('http://test.url.com')
|
||||
open_urlview.assert_called_with('http://test.url.com ❤')
|
||||
|
||||
Reference in New Issue
Block a user