コード例 #1
0
ファイル: test_account.py プロジェクト: quoyi/canvasapi
    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")
コード例 #2
0
ファイル: test_account.py プロジェクト: quoyi/canvasapi
    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,
            },
        )
コード例 #3
0
ファイル: test_account.py プロジェクト: quoyi/canvasapi
    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)