def test_update_global_notification(self, m): register_uris({"account": ["update_notification"]}, m) self.AccountNotification = AccountNotification( self.canvas._Canvas__requester, { "subject": "", "message": "", "start_at": "", "end_at": "", "id": 1, "account_id": 1, }, ) notif = { "subject": "subject", "message": "Message", "start_at": "2015-04-01T00:00:00Z", "end_at": "2018-04-01T00:00:00Z", "id": 1, "account_id": 1, } updated_notif = self.AccountNotification.update_global_notification( notif) self.assertIsInstance(updated_notif, AccountNotification) self.assertTrue(hasattr(updated_notif, "subject")) self.assertEqual(updated_notif.subject, "subject")
def setUp(self): self.canvas = Canvas(settings.BASE_URL, settings.API_KEY) self.AccountNotification = AccountNotification( self.canvas._Canvas__requester, { "subject": "subject", "message": "Message", "start_at": "2015-04-01T00:00:00Z", "end_at": "2018-04-01T00:00:00Z", "id": 1, "account_id": 1, }, )
def test_update_global_notification_missing_field(self, m): register_uris({"account": ["update_notification"]}, m) self.AccountNotification = AccountNotification( self.canvas._Canvas__requester, { "subject": "", "message": "", "start_at": "", "end_at": "", "id": 1, "account_id": 1, }, ) notif = {} with self.assertRaises(RequiredFieldMissing): self.AccountNotification.update_global_notification(notif)