All Classes Functions Properties
unity8.shell.tests.test_notifications.EphemeralNotificationsTests Class Reference
Inheritance diagram for unity8.shell.tests.test_notifications.EphemeralNotificationsTests:
[legend]
Collaboration diagram for unity8.shell.tests.test_notifications.EphemeralNotificationsTests:
[legend]

## Public Member Functions

def | setUp
def | test_icon_summary_body
def | test_icon_summary
def | test_urgency_order
def | test_summary_and_body
def | test_summary_only
def | test_update_notification_same_layout
def | test_update_notification_layout_change
def | test_append_hint
Public Member Functions inherited from unity8.shell.tests.UnityTestCase
def | setUpClass
def | setUp
def | launch_unity
def | patch_lightdm_mock
def | assertUnityReady
def | get_dash
def | main_window

## Additional Inherited Members

Public Attributes inherited from unity8.shell.tests.UnityTestCase
| touch
| unity_geometry_args
| grid_size
Static Public Attributes inherited from unity8.shell.tests.test_notifications.NotificationsBase
tuple | scenarios = _get_device_emulation_scenarios('Nexus4')

## Detailed Description

    Collection of tests for Emphemeral notifications (non-interactive.)

Definition at line 329 of file test_notifications.py.

## Member Function Documentation

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_append_hint | ( |  | self | ) |

    Notification has to accumulate body-text using append-hint.

Definition at line 630 of file test_notifications.py.

def test_append_hint(self):
"""Notification has to accumulate body-text using append-hint."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary = 'Cole Raby'
body = 'Hey Bro Coly!'
icon_path = self._get_icon_path('avatars/amanda.png')
body_sum = body
notification = self._create_ephemeral_notification(
summary,
body,
icon_path,
hints=[('x-canonical-append', 'true')]
)
notification.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification', objectName='notification1')
notification = get_notification()
self._assert_notification(
notification,
summary,
body_sum,
True,
False,
1.0
)
bodies = [
'What\'s up dude?',
'Did you watch the air-race in Oshkosh last week?',
'Phil owned the place like no one before him!',
'Did really everything in the race work according to regulations?',
'Somehow I think to remember Burt Williams did cut corners and '
'was not punished for this.',
'Hopefully the referees will watch the videos of the race.',
'Burt could get fined with US$ 50000 for that rule-violation :)'
]
for new_body in bodies:
body = new_body
body_sum += '\n' + body
notification = self._create_ephemeral_notification(
summary,
body,
icon_path,
hints=[('x-canonical-append', 'true')]
)
notification.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification',
objectName='notification1'
)
notification = get_notification()
self._assert_notification(
notification,
summary,
body_sum,
True,
False,
1.0
)
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.test_notifications.NotificationsBase._get_icon_path
def _get_icon_path
Definition: test_notifications.py:51
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_append_hint
def test_append_hint
Definition: test_notifications.py:630

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary | ( |  | self | ) |

    Notification must display the expected summary and secondary
    icon.

Definition at line 378 of file test_notifications.py.

def test_icon_summary(self):
"""Notification must display the expected summary and secondary
icon."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary = "Upload of image completed"
hints = [
(
"x-canonical-secondary-icon",
self._get_icon_path('applicationIcons/facebook.png')
)
]
notification = self._create_ephemeral_notification(
summary,
None,
None,
hints,
"NORMAL",
)
notification.show()
notification = lambda: notify_list.wait_select_single(
'Notification', objectName='notification1')
self._assert_notification(
notification(),
summary,
None,
False,
True,
1.0
)
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary
def test_icon_summary
Definition: test_notifications.py:378
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.test_notifications.NotificationsBase._get_icon_path
def _get_icon_path
Definition: test_notifications.py:51
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body | ( |  | self | ) |

    Notification must display the expected summary and body text.

Definition at line 339 of file test_notifications.py.

def test_icon_summary_body(self):
"""Notification must display the expected summary and body text."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary = "Icon-Summary-Body"
body = "Hey pal, what's up with the party next weekend? Will you " \
"join me and Anna?"
icon_path = self._get_icon_path('avatars/anna_olsson.png')
hints = [
(
"x-canonical-secondary-icon",
self._get_icon_path('applicationIcons/phone-app.png')
)
]
notification = self._create_ephemeral_notification(
summary,
body,
icon_path,
hints,
"NORMAL",
)
notification.show()
notification = lambda: notify_list.wait_select_single(
'Notification', objectName='notification1')
self._assert_notification(
notification(),
summary,
body,
True,
True,
1.0,
)
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body
def test_icon_summary_body
Definition: test_notifications.py:339
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.test_notifications.NotificationsBase._get_icon_path
def _get_icon_path
Definition: test_notifications.py:51
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body | ( |  | self | ) |

    Notification must display the expected summary- and body-text.

Definition at line 503 of file test_notifications.py.

def test_summary_and_body(self):
"""Notification must display the expected summary- and body-text."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary = 'Summary-Body'
body = 'This is a superfluous notification'
notification = self._create_ephemeral_notification(summary, body)
notification.show()
notification = notify_list.wait_select_single(
'Notification', objectName='notification1')
self._assert_notification(
notification,
summary,
body,
False,
False,
1.0
)
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body
def test_summary_and_body
Definition: test_notifications.py:503
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only | ( |  | self | ) |

    Notification must display only the expected summary-text.

Definition at line 528 of file test_notifications.py.

def test_summary_only(self):
"""Notification must display only the expected summary-text."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary = 'Summary-Only'
notification = self._create_ephemeral_notification(summary)
notification.show()
notification = notify_list.wait_select_single(
'Notification', objectName='notification1')
self._assert_notification(notification, summary, '', False, False, 1.0)
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only
def test_summary_only
Definition: test_notifications.py:528

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_update_notification_layout_change | ( |  | self | ) |

    Notification must allow updating its contents and layout while
    being displayed.

Definition at line 583 of file test_notifications.py.

def test_update_notification_layout_change(self):
"""Notification must allow updating its contents and layout while
being displayed."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary = 'Initial layout'
body = 'This bubble uses the icon-title-body layout with a ' \
'secondary icon.'
icon_path = self._get_icon_path('avatars/anna_olsson.png')
hint_icon = self._get_icon_path('applicationIcons/phone-app.png')
notification = self._create_ephemeral_notification(
summary,
body,
icon_path
)
notification.set_hint_string(
'x-canonical-secondary-icon',
hint_icon
)
notification.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification', objectName='notification1')
self._assert_notification(
get_notification(),
summary,
body,
True,
True,
1.0
)
notification.clear_hints()
summary = 'Updated layout'
body = 'After the update we now have a bubble using the title-body ' \
'layout.'
notification.update(summary, body, None)
notification.show()
self.assertThat(get_notification, Eventually(NotEquals(None)))
self._assert_notification(get_notification(), summary, body, False, False, 1.0)
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.test_notifications.NotificationsBase._get_icon_path
def _get_icon_path
Definition: test_notifications.py:51
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_update_notification_layout_change
def test_update_notification_layout_change
Definition: test_notifications.py:583

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_update_notification_same_layout | ( |  | self | ) |

    Notification must allow updating its contents while being
    displayed.

Definition at line 545 of file test_notifications.py.

def test_update_notification_same_layout(self):
"""Notification must allow updating its contents while being
displayed."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary = 'Initial notification'
body = 'This is the original content of this notification-bubble.'
icon_path = self._get_icon_path('avatars/funky.png')
notification = self._create_ephemeral_notification(
summary,
body,
icon_path
)
notification.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification', summary=summary)
self._assert_notification(
get_notification(),
summary,
body,
True,
False,
1.0
)
summary = 'Updated notification'
body = 'Here the same bubble with new title- and body-text, even ' \
'the icon can be changed on the update.'
icon_path = self._get_icon_path('avatars/amanda.png')
notification.update(summary, body, icon_path)
notification.show()
self._assert_notification(get_notification(), summary, body, True, False, 1.0)
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_update_notification_same_layout
def test_update_notification_same_layout
Definition: test_notifications.py:545
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.test_notifications.NotificationsBase._get_icon_path
def _get_icon_path
Definition: test_notifications.py:51
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_urgency_order | ( |  | self | ) |

    Notifications must be displayed in order according to their
    urgency.

Definition at line 415 of file test_notifications.py.

def test_urgency_order(self):
"""Notifications must be displayed in order according to their
urgency."""
unity_proxy = self.launch_unity()
unlock_unity(unity_proxy)
notify_list = self._get_notifications_list()
summary_low = 'Low Urgency'
body_low = "No, I'd rather see paint dry, pal *yawn*"
icon_path_low = self._get_icon_path('avatars/amanda.png')
summary_normal = 'Normal Urgency'
body_normal = "Hey pal, what's up with the party next weekend? Will " \
"you join me and Anna?"
icon_path_normal = self._get_icon_path('avatars/funky.png')
summary_critical = 'Critical Urgency'
body_critical = 'Dude, this is so urgent you have no idea :)'
icon_path_critical = self._get_icon_path('avatars/anna_olsson.png')
notification_normal = self._create_ephemeral_notification(
summary_normal,
body_normal,
icon_path_normal,
urgency="NORMAL"
)
notification_normal.show()
notification_low = self._create_ephemeral_notification(
summary_low,
body_low,
icon_path_low,
urgency="LOW"
)
notification_low.show()
notification_critical = self._create_ephemeral_notification(
summary_critical,
body_critical,
icon_path_critical,
urgency="CRITICAL"
)
notification_critical.show()
get_notification = lambda: notify_list.wait_select_single(
'Notification',
summary=summary_critical
)
notification = get_notification()
self._assert_notification(
notification,
summary_critical,
body_critical,
True,
False,
1.0
)
get_normal_notification = lambda: notify_list.wait_select_single(
'Notification',
summary=summary_normal
)
notification = get_normal_notification()
self._assert_notification(
notification,
summary_normal,
body_normal,
True,
False,
1.0
)
get_low_notification = lambda: notify_list.wait_select_single(
'Notification',
summary=summary_low
)
notification = get_low_notification()
self._assert_notification(
notification,
summary_low,
body_low,
True,
False,
1.0
)
unity8.shell.tests.test_notifications.NotificationsBase._get_notifications_list
def _get_notifications_list
Definition: test_notifications.py:69
unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_urgency_order
def test_urgency_order
Definition: test_notifications.py:415
unity8.shell.tests.test_notifications.NotificationsBase._assert_notification
def _assert_notification
Definition: test_notifications.py:83
unity8.shell.tests.test_notifications.EphemeralNotificationsTests._create_ephemeral_notification
def _create_ephemeral_notification
Definition: test_notifications.py:706
unity8.shell.tests.test_notifications.NotificationsBase._get_icon_path
def _get_icon_path
Definition: test_notifications.py:51
unity8.shell.tests.UnityTestCase.launch_unity
def launch_unity
Definition: __init__.py:252

The documentation for this class was generated from the following file:

- tests/autopilot/unity8/shell/tests/test_notifications.py