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)
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)
def test_delete_assignments(self, m): register_uris({'assignment': ['delete_assignment']}, m) deleted_assignment = self.assignment.delete() self.assertIsInstance(deleted_assignment, Assignment)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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"))
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)
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)
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)
def test_get_upcoming_events(self, m): register_uris({"user": ["upcoming_events"]}, m) events = self.canvas.get_upcoming_events() self.assertIsInstance(events, list)
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)
def test_clear_course_nicknames(self, m): register_uris({"user": ["course_nicknames_delete"]}, m) success = self.canvas.clear_course_nicknames() self.assertTrue(success)
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)
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")
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)
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)
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)
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)
def test_get_brand_variables(self, m): register_uris({"account": ["get_brand_variables"]}, m) variables = self.canvas.get_brand_variables() self.assertIsInstance(variables, dict)
def test_create_submission(self, m): register_uris({'quiz': ['create_submission']}, m) submission = self.quiz.create_submission() self.assertIsInstance(submission, QuizSubmission)
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])