on xenial help sign in
Updated asserts to use eventually, updated get_notification lambda to be more specific.
db5b4ceChristopher Lee
tests/autopilot/unity8/shell/tests/test_notifications.py+13−8
@@ -83,20 +83,26 @@ class NotificationsBase(UnityTestCase):
83 """
83 """
84
84
85 if summary is not None:
85 if summary is not None:
86− self.assertThat(notification.summary, Equals(summary))
86+ self.assertThat(notification.summary, Eventually(Equals(summary)))
87
87
88 if body is not None:
88 if body is not None:
89− self.assertThat(notification.body, Equals(body))
89+ self.assertThat(notification.body, Eventually(Equals(body)))
90
90
91 if icon:
91 if icon:
92− self.assertThat(notification.iconSource, NotEquals(""))
92+ self.assertThat(notification.iconSource, Eventually(NotEquals("")))
93 else:
93 else:
94− self.assertThat(notification.iconSource, Equals(""))
94+ self.assertThat(notification.iconSource, Eventually(Equals("")))
95
95
96 if secondary_icon:
96 if secondary_icon:
97+ self.assertThat(
97− self.assertThat(notification.secondaryIconSource, NotEquals(""))
98+ notification.secondaryIconSource,
99+ Eventually(NotEquals(""))
100+ )
98 else:
101 else:
102+ self.assertThat(
99− self.assertThat(notification.secondaryIconSource, Equals(""))
103+ notification.secondaryIconSource,
104+ Eventually(Equals(""))
105+ )
100
106
101 if opacity is not None:
107 if opacity is not None:
102 self.assertThat(notification.opacity, Eventually(Equals(opacity)))
108 self.assertThat(notification.opacity, Eventually(Equals(opacity)))
@@ -552,7 +558,7 @@ class EphemeralNotificationsTests(NotificationsBase):
552 )
558 )
553 notification.show()
559 notification.show()
554
560
555− get_notification = lambda: notify_list.select_single('Notification')
561+ get_notification = lambda: notify_list.select_single('Notification', summary=summary)
556 self.assertThat(get_notification, Eventually(NotEquals(None)))
562 self.assertThat(get_notification, Eventually(NotEquals(None)))
557 self._assert_notification(
563 self._assert_notification(
558 get_notification(),
564 get_notification(),
@@ -563,7 +569,6 @@ class EphemeralNotificationsTests(NotificationsBase):
563 1.0
569 1.0
564 )
570 )
565
571
566− time.sleep(3)
567 summary = 'Updated notification'
572 summary = 'Updated notification'
568 body = 'Here the same bubble with new title- and body-text, even ' \
573 body = 'Here the same bubble with new title- and body-text, even ' \
569 'the icon can be changed on the update.'
574 'the icon can be changed on the update.'