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)
 
- Public Member Functions inherited from unity8.shell.tests.UnityTestCase
def setUpClass (cls)
 
def setUp (self)
 
def launch_unity (self, kwargs)
 
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 409 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 455 of file test_notifications.py.

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

Definition at line 419 of file test_notifications.py.

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

Definition at line 576 of file test_notifications.py.

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

Definition at line 601 of file test_notifications.py.

601  def test_summary_only(self):
602  """Notification must display only the expected summary-text."""
603  unity_proxy = self.launch_unity()
604  unlock_unity(unity_proxy)
605 
606  notify_list = self._get_notifications_list()
607 
608  summary = 'Summary-Only'
609 
610  notification = shell.create_ephemeral_notification(summary)
611  notification.show()
612 
613  notification = notify_list.wait_select_single(
614  'Notification', objectName='notification1')
615 
616  self._assert_notification(notification, summary, '', False, False, 1.0)
617 
def launch_unity(self, kwargs)
Definition: __init__.py:256
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 657 of file test_notifications.py.

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

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

Definition at line 488 of file test_notifications.py.

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

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