Unity 8
unity8.shell.tests.test_notifications.EphemeralNotificationsTests Class Reference
Inheritance diagram for unity8.shell.tests.test_notifications.EphemeralNotificationsTests:
Collaboration diagram for unity8.shell.tests.test_notifications.EphemeralNotificationsTests:

Public Member Functions

def setUp (self)
 
def test_icon_summary_body (self)
 
def test_icon_summary (self)
 
def test_urgency_order (self)
 
def test_summary_and_body (self)
 
def test_summary_only (self)
 
def test_update_notification_same_layout (self)
 
def test_update_notification_layout_change (self)
 
def test_notification_helper (self)
 
- Public Member Functions inherited from unity8.shell.tests.UnityTestCase
def setUpClass (cls)
 
def setUp (self)
 
def launch_unity (self, mode="full-greeter", args)
 
def patch_lightdm_mock (self)
 
def wait_for_unity (self)
 
def get_dash (self)
 
def main_window (self)
 

Additional Inherited Members

- Public Attributes inherited from unity8.shell.tests.UnityTestCase
 unity_geometry_args
 
 grid_size
 
- Static Public Attributes inherited from unity8.shell.tests.test_notifications.NotificationsBase
tuple scenarios
 

Detailed Description

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

Definition at line 412 of file test_notifications.py.

Member Function Documentation

def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary (   self)
Notification must display the expected summary and secondary
icon.

Definition at line 458 of file test_notifications.py.

458  def test_icon_summary(self):
459  """Notification must display the expected summary and secondary
460  icon."""
461  self.launch_unity()
462  unlock_unity()
463 
464  notify_list = self._get_notifications_list()
465 
466  summary = "Upload of image completed"
467  icon_path = self._get_icon_path('applicationIcons/facebook.png')
468  hints = []
469 
470  notification = shell.create_ephemeral_notification(
471  summary,
472  None,
473  icon_path,
474  hints,
475  "NORMAL",
476  )
477 
478  notification.show()
479 
480  notification = lambda: notify_list.wait_select_single(
481  'Notification', objectName='notification1')
483  notification(),
484  summary,
485  None,
486  True,
487  False,
488  1.0
489  )
490 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:180
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body (   self)
Notification must display the expected summary and body text.

Definition at line 422 of file test_notifications.py.

423  """Notification must display the expected summary and body text."""
424  self.launch_unity()
425  unlock_unity()
426 
427  notify_list = self._get_notifications_list()
428 
429  summary = "Icon-Summary-Body"
430  body = "Hey pal, what's up with the party next weekend? Will you " \
431  "join me and Anna?"
432  icon_path = self._get_icon_path('avatars/anna_olsson.png')
433  hints = [
434  ("x-canonical-secondary-icon", "message")
435  ]
436 
437  notification = shell.create_ephemeral_notification(
438  summary,
439  body,
440  icon_path,
441  hints,
442  "NORMAL",
443  )
444 
445  notification.show()
446 
447  notification = lambda: notify_list.wait_select_single(
448  'Notification', objectName='notification1')
450  notification(),
451  summary,
452  body,
453  True,
454  True,
455  1.0,
456  )
457 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:180
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_notification_helper (   self)
use the create notification script to get a notification dialog.
Check that the arguments passed to the script match the fields. 

Definition at line 708 of file test_notifications.py.

709  """ use the create notification script to get a notification dialog.
710  Check that the arguments passed to the script match the fields. """
711 
712  self.launch_unity()
713  unlock_unity()
714 
715  summary = 'Helper summary'
716  body = 'Helper body'
717 
718  notification = shell.create_ephemeral_notification(summary, body)
719  notification.show()
720 
721  notification_data = self.main_window.wait_for_notification()
722 
723  self.assertThat(notification_data['summary'],
724  Eventually(Equals(summary)))
725  self.assertThat(notification_data['body'], Eventually(Equals(body)))
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body (   self)
Notification must display the expected summary- and body-text.

Definition at line 579 of file test_notifications.py.

580  """Notification must display the expected summary- and body-text."""
581  self.launch_unity()
582  unlock_unity()
583 
584  notify_list = self._get_notifications_list()
585 
586  summary = 'Summary-Body'
587  body = 'This is a superfluous notification'
588 
589  notification = shell.create_ephemeral_notification(summary, body)
590  notification.show()
591 
592  notification = notify_list.wait_select_single(
593  'Notification', objectName='notification1')
594 
596  notification,
597  summary,
598  body,
599  False,
600  False,
601  1.0
602  )
603 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:180
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only (   self)
Notification must display only the expected summary-text.

Definition at line 604 of file test_notifications.py.

604  def test_summary_only(self):
605  """Notification must display only the expected summary-text."""
606  self.launch_unity()
607  unlock_unity()
608 
609  notify_list = self._get_notifications_list()
610 
611  summary = 'Summary-Only'
612 
613  notification = shell.create_ephemeral_notification(summary)
614  notification.show()
615 
616  notification = notify_list.wait_select_single(
617  'Notification', objectName='notification1')
618 
619  self._assert_notification(notification, summary, '', False, False, 1.0)
620 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:180
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 660 of file test_notifications.py.

661  """Notification must allow updating its contents and layout while
662  being displayed."""
663  self.launch_unity()
664  unlock_unity()
665 
666  notify_list = self._get_notifications_list()
667 
668  summary = 'Initial layout'
669  body = 'This bubble uses the icon-title-body layout with a ' \
670  'secondary icon.'
671  icon_path = self._get_icon_path('avatars/anna_olsson.png')
672  hint_icon = 'dialer'
673 
674  notification = shell.create_ephemeral_notification(
675  summary,
676  body,
677  icon_path
678  )
679  notification.set_hint_string(
680  'x-canonical-secondary-icon',
681  hint_icon
682  )
683  notification.show()
684 
685  get_notification = lambda: notify_list.wait_select_single(
686  'Notification', objectName='notification1')
687 
689  get_notification(),
690  summary,
691  body,
692  True,
693  True,
694  1.0
695  )
696 
697  notification.clear_hints()
698  summary = 'Updated layout'
699  body = 'After the update we now have a bubble using the title-body ' \
700  'layout.'
701  notification.update(summary, body, None)
702  notification.show()
703 
704  self.assertThat(get_notification, Eventually(NotEquals(None)))
706  get_notification(), summary, body, False, False, 1.0)
707 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:180
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 621 of file test_notifications.py.

622  """Notification must allow updating its contents while being
623  displayed."""
624  self.launch_unity()
625  unlock_unity()
626 
627  notify_list = self._get_notifications_list()
628 
629  summary = 'Initial notification'
630  body = 'This is the original content of this notification-bubble.'
631  icon_path = self._get_icon_path('avatars/funky.png')
632 
633  notification = shell.create_ephemeral_notification(
634  summary,
635  body,
636  icon_path
637  )
638  notification.show()
639 
640  get_notification = lambda: notify_list.wait_select_single(
641  'Notification', summary=summary)
643  get_notification(),
644  summary,
645  body,
646  True,
647  False,
648  1.0
649  )
650 
651  summary = 'Updated notification'
652  body = 'Here the same bubble with new title- and body-text, even ' \
653  'the icon can be changed on the update.'
654  icon_path = self._get_icon_path('avatars/amanda.png')
655  notification.update(summary, body, icon_path)
656  notification.show()
658  get_notification(), summary, body, True, False, 1.0)
659 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:180
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_urgency_order (   self)
Notifications must be displayed in order according to their
urgency.

Definition at line 491 of file test_notifications.py.

492  """Notifications must be displayed in order according to their
493  urgency."""
494  self.launch_unity()
495  unlock_unity()
496 
497  notify_list = self._get_notifications_list()
498 
499  summary_low = 'Low Urgency'
500  body_low = "No, I'd rather see paint dry, pal *yawn*"
501  icon_path_low = self._get_icon_path('avatars/amanda.png')
502 
503  summary_normal = 'Normal Urgency'
504  body_normal = "Hey pal, what's up with the party next weekend? Will " \
505  "you join me and Anna?"
506  icon_path_normal = self._get_icon_path('avatars/funky.png')
507 
508  summary_critical = 'Critical Urgency'
509  body_critical = 'Dude, this is so urgent you have no idea :)'
510  icon_path_critical = self._get_icon_path('avatars/anna_olsson.png')
511 
512  notification_normal = shell.create_ephemeral_notification(
513  summary_normal,
514  body_normal,
515  icon_path_normal,
516  urgency="NORMAL"
517  )
518  notification_normal.show()
519 
520  notification_low = shell.create_ephemeral_notification(
521  summary_low,
522  body_low,
523  icon_path_low,
524  urgency="LOW"
525  )
526  notification_low.show()
527 
528  notification_critical = shell.create_ephemeral_notification(
529  summary_critical,
530  body_critical,
531  icon_path_critical,
532  urgency="CRITICAL"
533  )
534  notification_critical.show()
535 
536  get_notification = lambda: notify_list.wait_select_single(
537  'Notification',
538  summary=summary_critical
539  )
540 
541  notification = get_notification()
543  notification,
544  summary_critical,
545  body_critical,
546  True,
547  False,
548  1.0
549  )
550 
551  get_normal_notification = lambda: notify_list.wait_select_single(
552  'Notification',
553  summary=summary_normal
554  )
555  notification = get_normal_notification()
557  notification,
558  summary_normal,
559  body_normal,
560  True,
561  False,
562  1.0
563  )
564 
565  get_low_notification = lambda: notify_list.wait_select_single(
566  'Notification',
567  summary=summary_low
568  )
569  notification = get_low_notification()
571  notification,
572  summary_low,
573  body_low,
574  True,
575  False,
576  1.0
577  )
578 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:180

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