예제 #1
0
파일: tests.py 프로젝트: kotky/edx-platform
 def test_all_social_stats_defaults(self):
     """
     Tests that all_social_stats classmethod invokes get_user_social_stats with correct parameters
     when optional parameters are omitted
     """
     with mock.patch("lms.lib.comment_client.user.get_user_social_stats") as patched_stats:
         patched_stats.return_value = {}
         course_key = CourseLocator("edX", "demoX", "now")
         User.all_social_stats(course_key)
         patched_stats.assert_called_once_with("*", course_key, end_date=None, thread_type=None, thread_ids=None)
예제 #2
0
 def test_all_social_stats_defaults(self):
     """
     Tests that all_social_stats classmethod invokes get_user_social_stats with correct parameters
     when optional parameters are omitted
     """
     with mock.patch("lms.lib.comment_client.user.get_user_social_stats"
                     ) as patched_stats:
         patched_stats.return_value = {}
         course_key = CourseLocator("edX", "demoX", "now")
         User.all_social_stats(course_key)
         patched_stats.assert_called_once_with('*',
                                               course_key,
                                               end_date=None,
                                               thread_type=None,
                                               thread_ids=None)
예제 #3
0
파일: tests.py 프로젝트: kotky/edx-platform
 def test_all_social_stats_sends_correct_request(
     self, course_key, end_date, thread_type, thread_ids, expected_result
 ):
     """
     Tests that all_social_stats classmethod invokes get_user_social_stats with correct parameters
     when optional parameters are explicitly specified
     """
     with mock.patch("lms.lib.comment_client.user.get_user_social_stats") as patched_stats:
         patched_stats.return_value = expected_result
         result = User.all_social_stats(course_key, end_date, thread_type, thread_ids)
         self.assertEqual(result, expected_result)
         patched_stats.assert_called_once_with(
             "*", course_key, end_date=end_date, thread_type=thread_type, thread_ids=thread_ids
         )
예제 #4
0
 def test_all_social_stats_sends_correct_request(self, course_key, end_date,
                                                 thread_type, thread_ids,
                                                 expected_result):
     """
     Tests that all_social_stats classmethod invokes get_user_social_stats with correct parameters
     when optional parameters are explicitly specified
     """
     with mock.patch("lms.lib.comment_client.user.get_user_social_stats"
                     ) as patched_stats:
         patched_stats.return_value = expected_result
         result = User.all_social_stats(course_key, end_date, thread_type,
                                        thread_ids)
         self.assertEqual(result, expected_result)
         patched_stats.assert_called_once_with(
             '*',
             course_key,
             end_date=end_date,
             thread_type=thread_type,
             thread_ids=thread_ids,
         )