4
4
5
5
import pytest
6
6
from bs4 import BeautifulSoup
7
- from urwid import AttrWrap , Columns , Padding , Text
7
+ from urwid import Columns , Divider , Padding , Text
8
8
9
9
from zulipterminal .config .keys import is_command_key , keys_for_command
10
10
from zulipterminal .helper import powerset
@@ -1703,7 +1703,6 @@ def test_main_view_renders_slash_me(self, mocker, message, content,
1703
1703
], ids = ['different_stream_before' , 'different_topic_before' , 'PM_before' ])
1704
1704
def test_main_view_generates_stream_header (self , mocker , message ,
1705
1705
to_vary_in_last_message ):
1706
- mocker .patch (VIEWS + ".urwid.Text" )
1707
1706
self .model .stream_dict = {
1708
1707
5 : {
1709
1708
'color' : '#bd6' ,
@@ -1713,10 +1712,11 @@ def test_main_view_generates_stream_header(self, mocker, message,
1713
1712
msg_box = MessageBox (message , self .model , last_message )
1714
1713
view_components = msg_box .main_view ()
1715
1714
assert len (view_components ) == 3
1716
- assert isinstance (view_components [0 ], AttrWrap )
1717
- assert view_components [0 ].get_attr () == 'bar'
1718
- assert isinstance (view_components [1 ], Columns )
1719
- assert isinstance (view_components [2 ], Padding )
1715
+
1716
+ assert isinstance (view_components [0 ], Columns )
1717
+
1718
+ assert isinstance (view_components [0 ][0 ], Text )
1719
+ assert isinstance (view_components [0 ][1 ], Divider )
1720
1720
1721
1721
@pytest .mark .parametrize ('message' , [
1722
1722
{
@@ -1761,15 +1761,16 @@ def test_main_view_generates_stream_header(self, mocker, message,
1761
1761
], ids = ['larger_pm_group' , 'stream_before' ])
1762
1762
def test_main_view_generates_PM_header (self , mocker , message ,
1763
1763
to_vary_in_last_message ):
1764
- mocker .patch (VIEWS + ".urwid.Text" )
1765
1764
last_message = dict (message , ** to_vary_in_last_message )
1766
1765
msg_box = MessageBox (message , self .model , last_message )
1767
1766
view_components = msg_box .main_view ()
1768
1767
assert len (view_components ) == 3
1769
- assert isinstance (view_components [0 ], AttrWrap )
1770
- assert view_components [0 ].get_attr () == 'bar'
1771
- assert isinstance (view_components [1 ], Columns )
1772
- assert isinstance (view_components [2 ], Padding )
1768
+
1769
+ assert isinstance (view_components [0 ], Columns )
1770
+
1771
+ assert isinstance (view_components [0 ][0 ], Text )
1772
+ assert isinstance (view_components [0 ][1 ], Text )
1773
+ assert isinstance (view_components [0 ][2 ], Divider )
1773
1774
1774
1775
@pytest .mark .parametrize (['msg_narrow' , 'msg_type' , 'assert_header_bar' ,
1775
1776
'assert_search_bar' ], [
@@ -1814,7 +1815,7 @@ def test_msg_generates_search_and_header_bar(self, mocker,
1814
1815
search_bar = msg_box .top_search_bar ()
1815
1816
header_bar = msg_box .top_header_bar (msg_box )
1816
1817
1817
- assert header_bar .text .startswith (assert_header_bar )
1818
+ assert header_bar [ 0 ] .text .startswith (assert_header_bar )
1818
1819
assert search_bar .text_to_fill == assert_search_bar
1819
1820
1820
1821
# Assume recipient (PM/stream/topic) header is unchanged below
0 commit comments