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
 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 401 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 447 of file test_notifications.py.

447  def test_icon_summary(self):
448  """Notification must display the expected summary and secondary
449  icon."""
450  unity_proxy = self.launch_unity()
451  unlock_unity(unity_proxy)
452 
453  notify_list = self._get_notifications_list()
454 
455  summary = "Upload of image completed"
456  icon_path = self._get_icon_path('applicationIcons/facebook.png')
457  hints=[]
458 
459  notification = shell.create_ephemeral_notification(
460  summary,
461  None,
462  icon_path,
463  hints,
464  "NORMAL",
465  )
466 
467  notification.show()
468 
469  notification = lambda: notify_list.wait_select_single(
470  'Notification', objectName='notification1')
472  notification(),
473  summary,
474  None,
475  True,
476  False,
477  1.0
478  )
479 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:255
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body (   self)
Notification must display the expected summary and body text.

Definition at line 411 of file test_notifications.py.

412  """Notification must display the expected summary and body text."""
413  unity_proxy = self.launch_unity()
414  unlock_unity(unity_proxy)
415 
416  notify_list = self._get_notifications_list()
417 
418  summary = "Icon-Summary-Body"
419  body = "Hey pal, what's up with the party next weekend? Will you " \
420  "join me and Anna?"
421  icon_path = self._get_icon_path('avatars/anna_olsson.png')
422  hints = [
423  ("x-canonical-secondary-icon", "message")
424  ]
425 
426  notification = shell.create_ephemeral_notification(
427  summary,
428  body,
429  icon_path,
430  hints,
431  "NORMAL",
432  )
433 
434  notification.show()
435 
436  notification = lambda: notify_list.wait_select_single(
437  'Notification', objectName='notification1')
439  notification(),
440  summary,
441  body,
442  True,
443  True,
444  1.0,
445  )
446 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:255
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 697 of file test_notifications.py.

698  """ use the create notification script to get a notification dialog.
699  Check that the arguments passed to the script match the fields. """
700 
701  unity_proxy = self.launch_unity()
702  unlock_unity(unity_proxy)
703 
704  summary = 'Helper summary'
705  body = 'Helper body'
706 
707  notification = shell.create_ephemeral_notification(summary, body)
708  notification.show()
709 
710  notification_data = self.main_window.wait_for_notification()
711 
712  self.assertThat(notification_data['summary'],
713  Eventually(Equals(summary)))
714  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 568 of file test_notifications.py.

569  """Notification must display the expected summary- and body-text."""
570  unity_proxy = self.launch_unity()
571  unlock_unity(unity_proxy)
572 
573  notify_list = self._get_notifications_list()
574 
575  summary = 'Summary-Body'
576  body = 'This is a superfluous notification'
577 
578  notification = shell.create_ephemeral_notification(summary, body)
579  notification.show()
580 
581  notification = notify_list.wait_select_single(
582  'Notification', objectName='notification1')
583 
585  notification,
586  summary,
587  body,
588  False,
589  False,
590  1.0
591  )
592 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:255
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only (   self)
Notification must display only the expected summary-text.

Definition at line 593 of file test_notifications.py.

593  def test_summary_only(self):
594  """Notification must display only the expected summary-text."""
595  unity_proxy = self.launch_unity()
596  unlock_unity(unity_proxy)
597 
598  notify_list = self._get_notifications_list()
599 
600  summary = 'Summary-Only'
601 
602  notification = shell.create_ephemeral_notification(summary)
603  notification.show()
604 
605  notification = notify_list.wait_select_single(
606  'Notification', objectName='notification1')
607 
608  self._assert_notification(notification, summary, '', False, False, 1.0)
609 
def launch_unity(self, mode="full-greeter", args)
Definition: __init__.py:255
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 649 of file test_notifications.py.

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

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

Definition at line 480 of file test_notifications.py.

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

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