Unity 8
 All Classes Functions Properties
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
 
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 414 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 717 of file test_notifications.py.

718  def test_append_hint(self):
719  """Notification has to accumulate body-text using append-hint."""
720  unity_proxy = self.launch_unity()
721  unlock_unity(unity_proxy)
722 
723  notify_list = self._get_notifications_list()
724 
725  summary = 'Cole Raby'
726  body = 'Hey Bro Coly!'
727  icon_path = self._get_icon_path('avatars/amanda.png')
728  body_sum = body
729  notification = shell.create_ephemeral_notification(
730  summary,
731  body,
732  icon_path,
733  hints=[('x-canonical-append', 'true')]
734  )
735 
736  notification.show()
737 
738  get_notification = lambda: notify_list.wait_select_single(
739  'Notification', objectName='notification1')
740 
741  notification = get_notification()
743  notification,
744  summary,
745  body_sum,
746  True,
747  False,
748  1.0
749  )
750 
751  bodies = [
752  'What\'s up dude?',
753  'Did you watch the air-race in Oshkosh last week?',
754  'Phil owned the place like no one before him!',
755  'Did really everything in the race work according to regulations?',
756  'Somehow I think to remember Burt Williams did cut corners and '
757  'was not punished for this.',
758  'Hopefully the referees will watch the videos of the race.',
759  'Burt could get fined with US$ 50000 for that rule-violation :)'
760  ]
761 
762  for new_body in bodies:
763  body = new_body
764  body_sum += '\n' + body
765  notification = shell.create_ephemeral_notification(
766  summary,
767  body,
768  icon_path,
769  hints=[('x-canonical-append', 'true')]
770  )
771  notification.show()
772 
773  get_notification = lambda: notify_list.wait_select_single(
774  'Notification',
775  objectName='notification1'
776  )
777  notification = get_notification()
779  notification,
780  summary,
781  body_sum,
782  True,
783  False,
784  1.0
785  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary (   self)
Notification must display the expected summary and secondary
icon.

Definition at line 463 of file test_notifications.py.

464  def test_icon_summary(self):
465  """Notification must display the expected summary and secondary
466  icon."""
467  unity_proxy = self.launch_unity()
468  unlock_unity(unity_proxy)
469 
470  notify_list = self._get_notifications_list()
471 
472  summary = "Upload of image completed"
473  hints = [
474  (
475  "x-canonical-secondary-icon",
476  self._get_icon_path('applicationIcons/facebook.png')
477  )
478  ]
479 
480  notification = shell.create_ephemeral_notification(
481  summary,
482  None,
483  None,
484  hints,
485  "NORMAL",
486  )
487 
488  notification.show()
489 
490  notification = lambda: notify_list.wait_select_single(
491  'Notification', objectName='notification1')
493  notification(),
494  summary,
495  None,
496  False,
497  True,
498  1.0
499  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body (   self)
Notification must display the expected summary and body text.

Definition at line 424 of file test_notifications.py.

425  def test_icon_summary_body(self):
426  """Notification must display the expected summary and body text."""
427  unity_proxy = self.launch_unity()
428  unlock_unity(unity_proxy)
429 
430  notify_list = self._get_notifications_list()
431 
432  summary = "Icon-Summary-Body"
433  body = "Hey pal, what's up with the party next weekend? Will you " \
434  "join me and Anna?"
435  icon_path = self._get_icon_path('avatars/anna_olsson.png')
436  hints = [
437  (
438  "x-canonical-secondary-icon",
439  self._get_icon_path('applicationIcons/dialer-app.png')
440  )
441  ]
442 
443  notification = shell.create_ephemeral_notification(
444  summary,
445  body,
446  icon_path,
447  hints,
448  "NORMAL",
449  )
450 
451  notification.show()
452 
453  notification = lambda: notify_list.wait_select_single(
454  'Notification', objectName='notification1')
456  notification(),
457  summary,
458  body,
459  True,
460  True,
461  1.0,
462  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body (   self)
Notification must display the expected summary- and body-text.

Definition at line 588 of file test_notifications.py.

589  def test_summary_and_body(self):
590  """Notification must display the expected summary- and body-text."""
591  unity_proxy = self.launch_unity()
592  unlock_unity(unity_proxy)
593 
594  notify_list = self._get_notifications_list()
595 
596  summary = 'Summary-Body'
597  body = 'This is a superfluous notification'
598 
599  notification = shell.create_ephemeral_notification(summary, body)
600  notification.show()
601 
602  notification = notify_list.wait_select_single(
603  'Notification', objectName='notification1')
604 
606  notification,
607  summary,
608  body,
609  False,
610  False,
611  1.0
612  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only (   self)
Notification must display only the expected summary-text.

Definition at line 613 of file test_notifications.py.

614  def test_summary_only(self):
615  """Notification must display only the expected summary-text."""
616  unity_proxy = self.launch_unity()
617  unlock_unity(unity_proxy)
618 
619  notify_list = self._get_notifications_list()
620 
621  summary = 'Summary-Only'
622 
623  notification = shell.create_ephemeral_notification(summary)
624  notification.show()
625 
626  notification = notify_list.wait_select_single(
627  'Notification', objectName='notification1')
628 
629  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 669 of file test_notifications.py.

671  """Notification must allow updating its contents and layout while
672  being displayed."""
673  unity_proxy = self.launch_unity()
674  unlock_unity(unity_proxy)
675 
676  notify_list = self._get_notifications_list()
677 
678  summary = 'Initial layout'
679  body = 'This bubble uses the icon-title-body layout with a ' \
680  'secondary icon.'
681  icon_path = self._get_icon_path('avatars/anna_olsson.png')
682  hint_icon = self._get_icon_path('applicationIcons/dialer-app.png')
683 
684  notification = shell.create_ephemeral_notification(
685  summary,
686  body,
687  icon_path
688  )
689  notification.set_hint_string(
690  'x-canonical-secondary-icon',
691  hint_icon
692  )
693  notification.show()
694 
695  get_notification = lambda: notify_list.wait_select_single(
696  'Notification', objectName='notification1')
697 
699  get_notification(),
700  summary,
701  body,
702  True,
703  True,
704  1.0
705  )
706 
707  notification.clear_hints()
708  summary = 'Updated layout'
709  body = 'After the update we now have a bubble using the title-body ' \
710  'layout.'
711  notification.update(summary, body, None)
712  notification.show()
713 
714  self.assertThat(get_notification, Eventually(NotEquals(None)))
716  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 630 of file test_notifications.py.

632  """Notification must allow updating its contents while being
633  displayed."""
634  unity_proxy = self.launch_unity()
635  unlock_unity(unity_proxy)
636 
637  notify_list = self._get_notifications_list()
638 
639  summary = 'Initial notification'
640  body = 'This is the original content of this notification-bubble.'
641  icon_path = self._get_icon_path('avatars/funky.png')
642 
643  notification = shell.create_ephemeral_notification(
644  summary,
645  body,
646  icon_path
647  )
648  notification.show()
649 
650  get_notification = lambda: notify_list.wait_select_single(
651  'Notification', summary=summary)
653  get_notification(),
654  summary,
655  body,
656  True,
657  False,
658  1.0
659  )
660 
661  summary = 'Updated notification'
662  body = 'Here the same bubble with new title- and body-text, even ' \
663  'the icon can be changed on the update.'
664  icon_path = self._get_icon_path('avatars/amanda.png')
665  notification.update(summary, body, icon_path)
666  notification.show()
668  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 500 of file test_notifications.py.

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

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