コード例 #1
0
    def test_missing_cannot_be_posted_on_old_moves(self):
        geokret = self.blend_geokret(created_on_datetime='2019-01-12T22:53:05')
        move = self.blend_move(type=MOVE_TYPE_DROPPED,
                               geokret=geokret,
                               moved_on_datetime='2019-01-12T22:53:21')
        self.blend_move(type=MOVE_TYPE_DROPPED,
                        geokret=geokret,
                        moved_on_datetime='2019-01-12T22:53:43')
        payload = MoveCommentPayload().blend()\
            .set_move(move)\
            .set_type(MOVE_COMMENT_TYPE_MISSING)

        payload.post(user=self.user_1, code=422)\
            .assertRaiseJsonApiError('/data/relationships/move')

        payload.set_type(MOVE_COMMENT_TYPE_COMMENT).post(user=self.user_1)
コード例 #2
0
    def test_missing_can_be_reported_multiple_times(self, move_type):
        geokret = self.blend_geokret(created_on_datetime='2019-01-12T23:33:08')
        move = self.blend_move(type=move_type,
                               geokret=geokret,
                               moved_on_datetime='2019-01-12T23:33:20')

        payload = MoveCommentPayload().blend()\
            .set_move(move)\
            .set_type(MOVE_COMMENT_TYPE_COMMENT)
        comment1 = payload.post(user=self.user_1)
        comment2 = payload.post(user=self.user_1)
        comment3 = payload.post(user=self.user_1)

        payload = MoveCommentPayload().set_type(MOVE_COMMENT_TYPE_MISSING)
        payload.patch(comment1.id, user=self.user_1)
        payload.patch(comment2.id, user=self.user_1)
        payload.patch(comment3.id, user=self.user_1)