Skip to content

Commit

Permalink
add tests for replybox placeholder in online/offline mode
Browse files Browse the repository at this point in the history
  • Loading branch information
deeplow committed Oct 30, 2019
1 parent 669fe05 commit 7a8302d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2374,6 +2374,35 @@ def test_ReplyBoxWidget_disable(mocker):
rb.send_button.hide.assert_called_once_with()


def test_ReplyTextEdit_set_logged_out(mocker):
"""
Checks the placeholder text for reply box is correct for offline mode
"""
source = mocker.MagicMock()
controller = mocker.MagicMock()
rt = ReplyTextEdit(source, controller)

rt.set_logged_out()

assert 'Sign in' in rt.placeholder.text()
assert 'to compose or send a reply.' in rt.placeholder.text()


def test_ReplyTextEdit_set_logged_in(mocker):
"""
Checks the placeholder text for reply box is correct for online mode
"""
source = mocker.MagicMock()
source.journalist_designation = "journalist designation"
controller = mocker.MagicMock()
rt = ReplyTextEdit(source, controller)

rt.set_logged_in()

assert 'Compose a reply to' in rt.placeholder.text()
assert source.journalist_designation in rt.placeholder.text()


def test_update_conversation_maintains_old_items(mocker, session):
"""
Calling update_conversation deletes and adds old items back to layout
Expand Down

0 comments on commit 7a8302d

Please sign in to comment.