예제 #1
0
    def test_reorder_pinned_topics_tuple(self, m):
        register_uris({"group": ["reorder_pinned_topics"]}, m)

        order = (1, 2, 3)
        discussions = self.group.reorder_pinned_topics(order=order)
        self.assertTrue(discussions)
예제 #2
0
    def test_search_recipients(self, m):
        register_uris({"user": ["search_recipients"]}, m)

        recipients = self.canvas.search_recipients()
        self.assertIsInstance(recipients, list)
        self.assertEqual(len(recipients), 2)
예제 #3
0
    def test_delete_assignments(self, m):
        register_uris({'assignment': ['delete_assignment']}, m)

        deleted_assignment = self.assignment.delete()

        self.assertIsInstance(deleted_assignment, Assignment)
예제 #4
0
    def test_conversations_mark_all_as_read(self, m):
        register_uris({"conversation": ["mark_all_as_read"]}, m)

        result = self.canvas.conversations_mark_all_as_read()
        self.assertTrue(result)
예제 #5
0
    def test_get_calendar_events(self, m):
        register_uris({"calendar_event": ["list_calendar_events"]}, m)

        cal_events = self.canvas.get_calendar_events()
        cal_event_list = [cal_event for cal_event in cal_events]
        self.assertEqual(len(cal_event_list), 2)
예제 #6
0
    def test_get_todo_items(self, m):
        register_uris({"user": ["todo_items"]}, m)

        todo_items = self.canvas.get_todo_items()

        self.assertIsInstance(todo_items, list)
예제 #7
0
    def test_get_course_nickname_fail(self, m):
        register_uris({"generic": ["not_found"]}, m)

        with self.assertRaises(ResourceDoesNotExist):
            self.canvas.get_course_nickname(settings.INVALID_ID)
예제 #8
0
    def test_update(self, m):
        register_uris({"group": ["category_update"]}, m)

        new_name = "Test Update Category"
        response = self.group_category.update(name=new_name)
        self.assertIsInstance(response, GroupCategory)
예제 #9
0
    def test_get_page(self, m):
        register_uris({"group": ["get_page"]}, m)

        url = "my-url"
        page = self.group.get_page(url)
        self.assertIsInstance(page, Page)
예제 #10
0
    def test_create_content_migration_bad_migration_type(self, m):
        register_uris({"group": ["create_content_migration"]}, m)

        with self.assertRaises(TypeError):
            self.group.create_content_migration(1)
예제 #11
0
    def test_update(self, m):
        register_uris({"group": ["update_membership_membership"]}, m)

        response = self.membership.update(mem_id=1, moderator=False)
        self.assertIsInstance(response, GroupMembership)
예제 #12
0
    def test_create_folder(self, m):
        register_uris({"group": ["create_folder"]}, m)

        name_str = "Test String"
        response = self.group.create_folder(name=name_str)
        self.assertIsInstance(response, Folder)
예제 #13
0
    def test_create_external_feed(self, m):
        register_uris({"group": ["create_external_feed"]}, m)

        url_str = "https://example.com/myblog.rss"
        response = self.group.create_external_feed(url=url_str)
        self.assertIsInstance(response, ExternalFeed)
예제 #14
0
    def test_reorder_pinned_topics_comma_separated_string(self, m):
        register_uris({"group": ["reorder_pinned_topics"]}, m)

        order = "1,2,3"
        discussions = self.group.reorder_pinned_topics(order=order)
        self.assertTrue(discussions)
예제 #15
0
    def test_get_course_non_unicode_char(self, m):
        register_uris({"course": ["unicode_encode_error"]}, m)

        course = self.canvas.get_course(3)

        self.assertTrue(hasattr(course, "name"))
예제 #16
0
    def test_get_enrollment(self, m):
        register_uris({'enrollment': ['get_by_id']}, m)

        target_enrollment = self.account.get_enrollment(1)

        self.assertIsInstance(target_enrollment, Enrollment)
예제 #17
0
    def test_get_activity_stream_summary(self, m):
        register_uris({"user": ["activity_stream_summary"]}, m)

        summary = self.canvas.get_activity_stream_summary()

        self.assertIsInstance(summary, list)
예제 #18
0
    def test_create_group_category(self, m):
        register_uris({'account': ['create_group_category']}, m)

        name_str = "Test String"
        response = self.account.create_group_category(name=name_str)
        self.assertIsInstance(response, GroupCategory)
예제 #19
0
    def test_get_upcoming_events(self, m):
        register_uris({"user": ["upcoming_events"]}, m)

        events = self.canvas.get_upcoming_events()

        self.assertIsInstance(events, list)
예제 #20
0
    def test_close_notification_for_user_obj(self, m):
        register_uris({'account': ['close_notification']}, m)

        notif_id = 1
        self.account.close_notification_for_user(self.user, notif_id)
예제 #21
0
    def test_clear_course_nicknames(self, m):
        register_uris({"user": ["course_nicknames_delete"]}, m)

        success = self.canvas.clear_course_nicknames()
        self.assertTrue(success)
예제 #22
0
    def test_get_authentication_providers(self, m):
        register_uris({'account': ['get_authentication_providers']}, m)

        response = self.account.get_authentication_providers(1)

        self.assertIsInstance(response, AuthenticationProvider)
예제 #23
0
    def test_conversations_unread_count(self, m):
        register_uris({"conversation": ["unread_count"]}, m)

        result = self.canvas.conversations_unread_count()
        self.assertEqual(result["unread_count"], "7")
예제 #24
0
    def test_update_account_auth_settings(self, m):
        register_uris({'account': ['update_account_auth_settings']}, m)

        response = self.account.update_account_auth_settings()

        self.assertIsInstance(response, SSOSettings)
예제 #25
0
    def test_get_appointment_groups(self, m):
        register_uris({"appointment_group": ["list_appointment_groups"]}, m)

        appt_groups = self.canvas.get_appointment_groups()
        appt_groups_list = [appt_group for appt_group in appt_groups]
        self.assertEqual(len(appt_groups_list), 2)
예제 #26
0
    def test_get_course_accounts(self, m):
        register_uris({"account": ["multiple_course"]}, m)

        accounts = self.canvas.get_course_accounts()
        account_list = [account for account in accounts]
        self.assertEqual(len(account_list), 2)
예제 #27
0
    def test_search_all_courses(self, m):
        register_uris({"course": ["search_all_courses"]}, m)

        courses = self.canvas.search_all_courses()
        self.assertIsInstance(courses, list)
        self.assertEqual(len(courses), 2)
예제 #28
0
    def test_get_brand_variables(self, m):
        register_uris({"account": ["get_brand_variables"]}, m)

        variables = self.canvas.get_brand_variables()
        self.assertIsInstance(variables, dict)
예제 #29
0
    def test_create_submission(self, m):
        register_uris({'quiz': ['create_submission']}, m)

        submission = self.quiz.create_submission()

        self.assertIsInstance(submission, QuizSubmission)
예제 #30
0
    def test_get_activity_stream_summary(self, m):
        register_uris({"group": ["activity_stream_summary"]}, m)

        response = self.group.get_activity_stream_summary()
        self.assertEqual(len(response), 2)
        self.assertIn("type", response[0])