def test_notify_failed(self): with self.assertRaises(PushbulletException) as e: self.notifier.notify('hello', 'yaay') self.assertEqual(e.exception.code, 1) self.assertEqual(e.exception.message, "Access Token was not specified") settings = PushbulletSettings() self.notifier.update_settings(settings) with self.assertRaises(PushbulletException) as e: self.notifier.notify('hello', 'yaay') self.assertEqual(e.exception.code, 1) self.assertEqual(e.exception.message, "Access Token was not specified") settings.access_token = self.helper.fake_token self.notifier.update_settings(settings) with self.assertRaises(PushbulletException) as e: self.notifier.notify('hello', 'yaay') self.assertEqual(e.exception.code, 2) self.assertEqual(e.exception.message, 'Failed to send Pushbullet notification')
def test_notify_link(self): settings = PushbulletSettings() settings.access_token = self.helper.real_token self.notifier.update_settings(settings) response = self.notifier.notify('hello', 'yay', 'http://mywebsite.com') self.assertTrue(response)