コード例 #1
0
 def make_cs_content(self, overrides=None, with_endorsement=False):
     """
     Create a comment with the given overrides, plus some useful test data.
     """
     merged_overrides = {
         "user_id": str(self.author.id),
         "username": self.author.username
     }
     if with_endorsement:
         merged_overrides["endorsement"] = {
             "user_id": str(self.endorser.id),
             "time": self.endorsed_at
         }
     merged_overrides.update(overrides or {})
     return make_minimal_cs_comment(merged_overrides)
コード例 #2
0
ファイル: test_serializers.py プロジェクト: edx/edx-platform
 def make_cs_content(self, overrides=None, with_endorsement=False):
     """
     Create a comment with the given overrides, plus some useful test data.
     """
     merged_overrides = {
         "user_id": str(self.author.id),
         "username": self.author.username
     }
     if with_endorsement:
         merged_overrides["endorsement"] = {
             "user_id": str(self.endorser.id),
             "time": self.endorsed_at
         }
     merged_overrides.update(overrides or {})
     return make_minimal_cs_comment(merged_overrides)
コード例 #3
0
ファイル: test_serializers.py プロジェクト: edx/edx-platform
 def setUp(self):
     super(CommentSerializerDeserializationTest, self).setUp()
     httpretty.reset()
     httpretty.enable()
     self.addCleanup(httpretty.reset)
     self.addCleanup(httpretty.disable)
     self.user = UserFactory.create()
     self.register_get_user_response(self.user)
     self.request = RequestFactory().get("/dummy")
     self.request.user = self.user
     self.minimal_data = {
         "thread_id": "test_thread",
         "raw_body": "Test body",
     }
     self.existing_comment = Comment(**make_minimal_cs_comment({
         "id": "existing_comment",
         "thread_id": "existing_thread",
         "body": "Original body",
         "user_id": str(self.user.id),
         "username": self.user.username,
         "course_id": six.text_type(self.course.id),
     }))
コード例 #4
0
 def setUp(self):
     super().setUp()
     httpretty.reset()
     httpretty.enable()
     self.addCleanup(httpretty.reset)
     self.addCleanup(httpretty.disable)
     self.user = UserFactory.create()
     self.register_get_user_response(self.user)
     self.request = RequestFactory().get("/dummy")
     self.request.user = self.user
     self.minimal_data = {
         "thread_id": "test_thread",
         "raw_body": "Test body",
     }
     self.existing_comment = Comment(**make_minimal_cs_comment({
         "id": "existing_comment",
         "thread_id": "existing_thread",
         "body": "Original body",
         "user_id": str(self.user.id),
         "username": self.user.username,
         "course_id": str(self.course.id),
     }))