Unity 8
 All Classes Functions
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
 
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
 
- Public Member Functions inherited from unity8.shell.tests.UnityTestCase
def setUpClass
 
def setUp
 
def launch_unity
 
def patch_lightdm_mock
 
def wait_for_unity
 
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 459 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 505 of file test_notifications.py.

506  def test_icon_summary(self):
507  """Notification must display the expected summary and secondary
508  icon."""
509  unity_proxy = self.launch_unity()
510  unlock_unity(unity_proxy)
511 
512  notify_list = self._get_notifications_list()
513 
514  summary = "Upload of image completed"
515  icon_path = self._get_icon_path('applicationIcons/facebook.png')
516  hints=[]
517 
518  notification = shell.create_ephemeral_notification(
519  summary,
520  None,
521  icon_path,
522  hints,
523  "NORMAL",
524  )
525 
526  notification.show()
527 
528  notification = lambda: notify_list.wait_select_single(
529  'Notification', objectName='notification1')
531  notification(),
532  summary,
533  None,
534  True,
535  False,
536  1.0
537  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body (   self)
Notification must display the expected summary and body text.

Definition at line 469 of file test_notifications.py.

470  def test_icon_summary_body(self):
471  """Notification must display the expected summary and body text."""
472  unity_proxy = self.launch_unity()
473  unlock_unity(unity_proxy)
474 
475  notify_list = self._get_notifications_list()
476 
477  summary = "Icon-Summary-Body"
478  body = "Hey pal, what's up with the party next weekend? Will you " \
479  "join me and Anna?"
480  icon_path = self._get_icon_path('avatars/anna_olsson.png')
481  hints = [
482  ("x-canonical-secondary-icon", "message")
483  ]
484 
485  notification = shell.create_ephemeral_notification(
486  summary,
487  body,
488  icon_path,
489  hints,
490  "NORMAL",
491  )
492 
493  notification.show()
494 
495  notification = lambda: notify_list.wait_select_single(
496  'Notification', objectName='notification1')
498  notification(),
499  summary,
500  body,
501  True,
502  True,
503  1.0,
504  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body (   self)
Notification must display the expected summary- and body-text.

Definition at line 626 of file test_notifications.py.

627  def test_summary_and_body(self):
628  """Notification must display the expected summary- and body-text."""
629  unity_proxy = self.launch_unity()
630  unlock_unity(unity_proxy)
631 
632  notify_list = self._get_notifications_list()
633 
634  summary = 'Summary-Body'
635  body = 'This is a superfluous notification'
636 
637  notification = shell.create_ephemeral_notification(summary, body)
638  notification.show()
639 
640  notification = notify_list.wait_select_single(
641  'Notification', objectName='notification1')
642 
644  notification,
645  summary,
646  body,
647  False,
648  False,
649  1.0
650  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only (   self)
Notification must display only the expected summary-text.

Definition at line 651 of file test_notifications.py.

652  def test_summary_only(self):
653  """Notification must display only the expected summary-text."""
654  unity_proxy = self.launch_unity()
655  unlock_unity(unity_proxy)
656 
657  notify_list = self._get_notifications_list()
658 
659  summary = 'Summary-Only'
660 
661  notification = shell.create_ephemeral_notification(summary)
662  notification.show()
663 
664  notification = notify_list.wait_select_single(
665  'Notification', objectName='notification1')
666 
667  self._assert_notification(notification, summary, '', False, False, 1.0)
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 707 of file test_notifications.py.

709  """Notification must allow updating its contents and layout while
710  being displayed."""
711  unity_proxy = self.launch_unity()
712  unlock_unity(unity_proxy)
713 
714  notify_list = self._get_notifications_list()
715 
716  summary = 'Initial layout'
717  body = 'This bubble uses the icon-title-body layout with a ' \
718  'secondary icon.'
719  icon_path = self._get_icon_path('avatars/anna_olsson.png')
720  hint_icon = 'dialer'
721 
722  notification = shell.create_ephemeral_notification(
723  summary,
724  body,
725  icon_path
726  )
727  notification.set_hint_string(
728  'x-canonical-secondary-icon',
729  hint_icon
730  )
731  notification.show()
732 
733  get_notification = lambda: notify_list.wait_select_single(
734  'Notification', objectName='notification1')
735 
737  get_notification(),
738  summary,
739  body,
740  True,
741  True,
742  1.0
743  )
744 
745  notification.clear_hints()
746  summary = 'Updated layout'
747  body = 'After the update we now have a bubble using the title-body ' \
748  'layout.'
749  notification.update(summary, body, None)
750  notification.show()
751 
752  self.assertThat(get_notification, Eventually(NotEquals(None)))
754  get_notification(), summary, body, False, False, 1.0)
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 668 of file test_notifications.py.

670  """Notification must allow updating its contents while being
671  displayed."""
672  unity_proxy = self.launch_unity()
673  unlock_unity(unity_proxy)
674 
675  notify_list = self._get_notifications_list()
676 
677  summary = 'Initial notification'
678  body = 'This is the original content of this notification-bubble.'
679  icon_path = self._get_icon_path('avatars/funky.png')
680 
681  notification = shell.create_ephemeral_notification(
682  summary,
683  body,
684  icon_path
685  )
686  notification.show()
687 
688  get_notification = lambda: notify_list.wait_select_single(
689  'Notification', summary=summary)
691  get_notification(),
692  summary,
693  body,
694  True,
695  False,
696  1.0
697  )
698 
699  summary = 'Updated notification'
700  body = 'Here the same bubble with new title- and body-text, even ' \
701  'the icon can be changed on the update.'
702  icon_path = self._get_icon_path('avatars/amanda.png')
703  notification.update(summary, body, icon_path)
704  notification.show()
706  get_notification(), summary, body, True, False, 1.0)
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_urgency_order (   self)
Notifications must be displayed in order according to their
urgency.

Definition at line 538 of file test_notifications.py.

539  def test_urgency_order(self):
540  """Notifications must be displayed in order according to their
541  urgency."""
542  unity_proxy = self.launch_unity()
543  unlock_unity(unity_proxy)
544 
545  notify_list = self._get_notifications_list()
546 
547  summary_low = 'Low Urgency'
548  body_low = "No, I'd rather see paint dry, pal *yawn*"
549  icon_path_low = self._get_icon_path('avatars/amanda.png')
550 
551  summary_normal = 'Normal Urgency'
552  body_normal = "Hey pal, what's up with the party next weekend? Will " \
553  "you join me and Anna?"
554  icon_path_normal = self._get_icon_path('avatars/funky.png')
555 
556  summary_critical = 'Critical Urgency'
557  body_critical = 'Dude, this is so urgent you have no idea :)'
558  icon_path_critical = self._get_icon_path('avatars/anna_olsson.png')
559 
560  notification_normal = shell.create_ephemeral_notification(
561  summary_normal,
562  body_normal,
563  icon_path_normal,
564  urgency="NORMAL"
565  )
566  notification_normal.show()
567 
568  notification_low = shell.create_ephemeral_notification(
569  summary_low,
570  body_low,
571  icon_path_low,
572  urgency="LOW"
573  )
574  notification_low.show()
575 
576  notification_critical = shell.create_ephemeral_notification(
577  summary_critical,
578  body_critical,
579  icon_path_critical,
580  urgency="CRITICAL"
581  )
582  notification_critical.show()
583 
584  get_notification = lambda: notify_list.wait_select_single(
585  'Notification',
586  summary=summary_critical
587  )
588 
589  notification = get_notification()
591  notification,
592  summary_critical,
593  body_critical,
594  True,
595  False,
596  1.0
597  )
598 
599  get_normal_notification = lambda: notify_list.wait_select_single(
600  'Notification',
601  summary=summary_normal
602  )
603  notification = get_normal_notification()
605  notification,
606  summary_normal,
607  body_normal,
608  True,
609  False,
610  1.0
611  )
612 
613  get_low_notification = lambda: notify_list.wait_select_single(
614  'Notification',
615  summary=summary_low
616  )
617  notification = get_low_notification()
619  notification,
620  summary_low,
621  body_low,
622  True,
623  False,
624  1.0
625  )

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