Added unit tests for banner.
This commit is contained in:
@@ -28,6 +28,14 @@ def test_submission_page_construct(reddit, terminal, config, oauth):
|
|||||||
title = url[:terminal.stdscr.ncols-1].encode('utf-8')
|
title = url[:terminal.stdscr.ncols-1].encode('utf-8')
|
||||||
window.addstr.assert_any_call(0, 0, title)
|
window.addstr.assert_any_call(0, 0, title)
|
||||||
|
|
||||||
|
# Banner
|
||||||
|
menu = ('[1]hot '
|
||||||
|
'[2]top '
|
||||||
|
'[3]rising '
|
||||||
|
'[4]new '
|
||||||
|
'[5]controversial').encode('utf-8')
|
||||||
|
window.addstr.assert_any_call(0, 0, menu)
|
||||||
|
|
||||||
# Submission
|
# Submission
|
||||||
submission_data = page.content.get(-1)
|
submission_data = page.content.get(-1)
|
||||||
text = submission_data['title'].encode('utf-8')
|
text = submission_data['title'].encode('utf-8')
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ def test_subreddit_page_construct(reddit, terminal, config, oauth):
|
|||||||
title = '/r/python'.encode('utf-8')
|
title = '/r/python'.encode('utf-8')
|
||||||
window.addstr.assert_any_call(0, 0, title)
|
window.addstr.assert_any_call(0, 0, title)
|
||||||
|
|
||||||
|
# Banner
|
||||||
|
menu = ('[1]hot '
|
||||||
|
'[2]top '
|
||||||
|
'[3]rising '
|
||||||
|
'[4]new '
|
||||||
|
'[5]controversial').encode('utf-8')
|
||||||
|
window.addstr.assert_any_call(0, 0, menu)
|
||||||
|
|
||||||
# Submission
|
# Submission
|
||||||
text = page.content.get(0)['split_title'][0].encode('utf-8')
|
text = page.content.get(0)['split_title'][0].encode('utf-8')
|
||||||
window.subwin.addstr.assert_any_call(0, 1, text, 2097152)
|
window.subwin.addstr.assert_any_call(0, 1, text, 2097152)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||||||
import curses
|
import curses
|
||||||
|
|
||||||
import praw
|
import praw
|
||||||
|
import pytest
|
||||||
|
|
||||||
from rtv.subscription import SubscriptionPage
|
from rtv.subscription import SubscriptionPage
|
||||||
|
|
||||||
@@ -41,6 +42,15 @@ def test_subscription_page_construct(reddit, terminal, config, oauth,
|
|||||||
name = reddit.user.name.encode('utf-8')
|
name = reddit.user.name.encode('utf-8')
|
||||||
window.addstr.assert_any_call(0, 59, name)
|
window.addstr.assert_any_call(0, 59, name)
|
||||||
|
|
||||||
|
# Banner shouldn't be drawn
|
||||||
|
menu = ('[1]hot '
|
||||||
|
'[2]top '
|
||||||
|
'[3]rising '
|
||||||
|
'[4]new '
|
||||||
|
'[5]controversial').encode('utf-8')
|
||||||
|
with pytest.raises(AssertionError):
|
||||||
|
window.addstr.assert_any_call(0, 0, menu)
|
||||||
|
|
||||||
# Cursor - 2 lines
|
# Cursor - 2 lines
|
||||||
window.subwin.chgat.assert_any_call(0, 0, 1, 262144)
|
window.subwin.chgat.assert_any_call(0, 0, 1, 262144)
|
||||||
window.subwin.chgat.assert_any_call(1, 0, 1, 262144)
|
window.subwin.chgat.assert_any_call(1, 0, 1, 262144)
|
||||||
|
|||||||
Reference in New Issue
Block a user