def test_notifier_partial(notify, exts): notifier = mod.Notifier() dest = mock.Mock() dest.humanized_name = 'my storage' dest.id = 'abcd' notifier.partial(dest) template = mod.Notifier.messages['partial'] msg = template.format(storage_name=dest.humanized_name) notify.assert_called_once_with(msg, mod.exts.notifications.URGENT)
def test_notifier_success(notify, exts): notifier = mod.Notifier() dest = mock.Mock() dest.humanized_name = 'my storage' dest.id = 'abcd' notifier.success(dest) template = mod.Notifier.messages['success'] msg = template.format(storage_name=dest.humanized_name) notify.assert_called_once_with(msg, mod.exts.notifications.NORMAL)
def test_notifier_notify(exts): notifier = mod.Notifier() notifier.notify('some msg', 'some priority') exts.notifications.send.assert_called_once_with( 'some msg', category='consolidate_storage', dismissable=True, group='superuser', priority='some priority', db=exts.databases.librarian)
def test_notifier_clear(exts): notifier = mod.Notifier() notifier.clear() args = ('consolidate_storage', exts.databases.librarian) exts.notifications.delete_by_category.assert_called_once_with(*args)