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 329 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 630 of file test_notifications.py.

631  def test_append_hint(self):
632  """Notification has to accumulate body-text using append-hint."""
633  unity_proxy = self.launch_unity()
634  unlock_unity(unity_proxy)
635 
636  notify_list = self._get_notifications_list()
637 
638  summary = 'Cole Raby'
639  body = 'Hey Bro Coly!'
640  icon_path = self._get_icon_path('avatars/amanda.png')
641  body_sum = body
642  notification = self._create_ephemeral_notification(
643  summary,
644  body,
645  icon_path,
646  hints=[('x-canonical-append', 'true')]
647  )
648 
649  notification.show()
650 
651  get_notification = lambda: notify_list.wait_select_single(
652  'Notification', objectName='notification1')
653 
654  notification = get_notification()
656  notification,
657  summary,
658  body_sum,
659  True,
660  False,
661  1.0
662  )
663 
664  bodies = [
665  'What\'s up dude?',
666  'Did you watch the air-race in Oshkosh last week?',
667  'Phil owned the place like no one before him!',
668  'Did really everything in the race work according to regulations?',
669  'Somehow I think to remember Burt Williams did cut corners and '
670  'was not punished for this.',
671  'Hopefully the referees will watch the videos of the race.',
672  'Burt could get fined with US$ 50000 for that rule-violation :)'
673  ]
674 
675  for new_body in bodies:
676  body = new_body
677  body_sum += '\n' + body
678  notification = self._create_ephemeral_notification(
679  summary,
680  body,
681  icon_path,
682  hints=[('x-canonical-append', 'true')]
683  )
684  notification.show()
685 
686  get_notification = lambda: notify_list.wait_select_single(
687  'Notification',
688  objectName='notification1'
689  )
690  notification = get_notification()
692  notification,
693  summary,
694  body_sum,
695  True,
696  False,
697  1.0
698  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary (   self)
Notification must display the expected summary and secondary
icon.

Definition at line 378 of file test_notifications.py.

379  def test_icon_summary(self):
380  """Notification must display the expected summary and secondary
381  icon."""
382  unity_proxy = self.launch_unity()
383  unlock_unity(unity_proxy)
384 
385  notify_list = self._get_notifications_list()
386 
387  summary = "Upload of image completed"
388  hints = [
389  (
390  "x-canonical-secondary-icon",
391  self._get_icon_path('applicationIcons/facebook.png')
392  )
393  ]
394 
395  notification = self._create_ephemeral_notification(
396  summary,
397  None,
398  None,
399  hints,
400  "NORMAL",
401  )
402 
403  notification.show()
404 
405  notification = lambda: notify_list.wait_select_single(
406  'Notification', objectName='notification1')
408  notification(),
409  summary,
410  None,
411  False,
412  True,
413  1.0
414  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_icon_summary_body (   self)
Notification must display the expected summary and body text.

Definition at line 339 of file test_notifications.py.

340  def test_icon_summary_body(self):
341  """Notification must display the expected summary and body text."""
342  unity_proxy = self.launch_unity()
343  unlock_unity(unity_proxy)
344 
345  notify_list = self._get_notifications_list()
346 
347  summary = "Icon-Summary-Body"
348  body = "Hey pal, what's up with the party next weekend? Will you " \
349  "join me and Anna?"
350  icon_path = self._get_icon_path('avatars/anna_olsson.png')
351  hints = [
352  (
353  "x-canonical-secondary-icon",
354  self._get_icon_path('applicationIcons/phone-app.png')
355  )
356  ]
357 
358  notification = self._create_ephemeral_notification(
359  summary,
360  body,
361  icon_path,
362  hints,
363  "NORMAL",
364  )
365 
366  notification.show()
367 
368  notification = lambda: notify_list.wait_select_single(
369  'Notification', objectName='notification1')
371  notification(),
372  summary,
373  body,
374  True,
375  True,
376  1.0,
377  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_and_body (   self)
Notification must display the expected summary- and body-text.

Definition at line 503 of file test_notifications.py.

504  def test_summary_and_body(self):
505  """Notification must display the expected summary- and body-text."""
506  unity_proxy = self.launch_unity()
507  unlock_unity(unity_proxy)
508 
509  notify_list = self._get_notifications_list()
510 
511  summary = 'Summary-Body'
512  body = 'This is a superfluous notification'
513 
514  notification = self._create_ephemeral_notification(summary, body)
515  notification.show()
516 
517  notification = notify_list.wait_select_single(
518  'Notification', objectName='notification1')
519 
521  notification,
522  summary,
523  body,
524  False,
525  False,
526  1.0
527  )
def unity8.shell.tests.test_notifications.EphemeralNotificationsTests.test_summary_only (   self)
Notification must display only the expected summary-text.

Definition at line 528 of file test_notifications.py.

529  def test_summary_only(self):
530  """Notification must display only the expected summary-text."""
531  unity_proxy = self.launch_unity()
532  unlock_unity(unity_proxy)
533 
534  notify_list = self._get_notifications_list()
535 
536  summary = 'Summary-Only'
537 
538  notification = self._create_ephemeral_notification(summary)
539  notification.show()
540 
541  notification = notify_list.wait_select_single(
542  'Notification', objectName='notification1')
543 
544  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 583 of file test_notifications.py.

585  """Notification must allow updating its contents and layout while
586  being displayed."""
587  unity_proxy = self.launch_unity()
588  unlock_unity(unity_proxy)
589 
590  notify_list = self._get_notifications_list()
591 
592  summary = 'Initial layout'
593  body = 'This bubble uses the icon-title-body layout with a ' \
594  'secondary icon.'
595  icon_path = self._get_icon_path('avatars/anna_olsson.png')
596  hint_icon = self._get_icon_path('applicationIcons/phone-app.png')
597 
598  notification = self._create_ephemeral_notification(
599  summary,
600  body,
601  icon_path
602  )
603  notification.set_hint_string(
604  'x-canonical-secondary-icon',
605  hint_icon
606  )
607  notification.show()
608 
609  get_notification = lambda: notify_list.wait_select_single(
610  'Notification', objectName='notification1')
611 
613  get_notification(),
614  summary,
615  body,
616  True,
617  True,
618  1.0
619  )
620 
621  notification.clear_hints()
622  summary = 'Updated layout'
623  body = 'After the update we now have a bubble using the title-body ' \
624  'layout.'
625  notification.update(summary, body, None)
626  notification.show()
627 
628  self.assertThat(get_notification, Eventually(NotEquals(None)))
629  self._assert_notification(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 545 of file test_notifications.py.

547  """Notification must allow updating its contents while being
548  displayed."""
549  unity_proxy = self.launch_unity()
550  unlock_unity(unity_proxy)
551 
552  notify_list = self._get_notifications_list()
553 
554  summary = 'Initial notification'
555  body = 'This is the original content of this notification-bubble.'
556  icon_path = self._get_icon_path('avatars/funky.png')
557 
558  notification = self._create_ephemeral_notification(
559  summary,
560  body,
561  icon_path
562  )
563  notification.show()
564 
565  get_notification = lambda: notify_list.wait_select_single(
566  'Notification', summary=summary)
568  get_notification(),
569  summary,
570  body,
571  True,
572  False,
573  1.0
574  )
575 
576  summary = 'Updated notification'
577  body = 'Here the same bubble with new title- and body-text, even ' \
578  'the icon can be changed on the update.'
579  icon_path = self._get_icon_path('avatars/amanda.png')
580  notification.update(summary, body, icon_path)
581  notification.show()
582  self._assert_notification(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 415 of file test_notifications.py.

416  def test_urgency_order(self):
417  """Notifications must be displayed in order according to their
418  urgency."""
419  unity_proxy = self.launch_unity()
420  unlock_unity(unity_proxy)
421 
422  notify_list = self._get_notifications_list()
423 
424  summary_low = 'Low Urgency'
425  body_low = "No, I'd rather see paint dry, pal *yawn*"
426  icon_path_low = self._get_icon_path('avatars/amanda.png')
427 
428  summary_normal = 'Normal Urgency'
429  body_normal = "Hey pal, what's up with the party next weekend? Will " \
430  "you join me and Anna?"
431  icon_path_normal = self._get_icon_path('avatars/funky.png')
432 
433  summary_critical = 'Critical Urgency'
434  body_critical = 'Dude, this is so urgent you have no idea :)'
435  icon_path_critical = self._get_icon_path('avatars/anna_olsson.png')
436 
437  notification_normal = self._create_ephemeral_notification(
438  summary_normal,
439  body_normal,
440  icon_path_normal,
441  urgency="NORMAL"
442  )
443  notification_normal.show()
444 
445  notification_low = self._create_ephemeral_notification(
446  summary_low,
447  body_low,
448  icon_path_low,
449  urgency="LOW"
450  )
451  notification_low.show()
452 
453  notification_critical = self._create_ephemeral_notification(
454  summary_critical,
455  body_critical,
456  icon_path_critical,
457  urgency="CRITICAL"
458  )
459  notification_critical.show()
460 
461  get_notification = lambda: notify_list.wait_select_single(
462  'Notification',
463  summary=summary_critical
464  )
465 
466  notification = get_notification()
468  notification,
469  summary_critical,
470  body_critical,
471  True,
472  False,
473  1.0
474  )
475 
476  get_normal_notification = lambda: notify_list.wait_select_single(
477  'Notification',
478  summary=summary_normal
479  )
480  notification = get_normal_notification()
482  notification,
483  summary_normal,
484  body_normal,
485  True,
486  False,
487  1.0
488  )
489 
490  get_low_notification = lambda: notify_list.wait_select_single(
491  'Notification',
492  summary=summary_low
493  )
494  notification = get_low_notification()
496  notification,
497  summary_low,
498  body_low,
499  True,
500  False,
501  1.0
502  )

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