コード例 #1
0
 def test_set_questions_answer_a_null(self):
     """
     测试请求接口答案A为空
     :return:
     """
     set_questions_api = SetQuestionsApi(self.game_anchor_login_name)
     set_questions_api.get({
         'room_id': self.game_room,
         'question': self.questions,
         'option_a': None,
         'option_b': self.option_b
     })
     self.assertEqual(set_questions_api.get_code(), 505402)
     self.assertEqual(set_questions_api.get_response_message(), u'答案不能为空')
コード例 #2
0
 def test_set_questions_other_room(self):
     """
     测试添加题目到其他房间题库失败
     :return:
     """
     set_questions_api = SetQuestionsApi(self.game_anchor_login_name)
     set_questions_api.get({
         'room_id': self.other_room,
         'question': self.questions,
         'option_a': self.option_a,
         'option_b': self.option_b
     })
     self.assertEqual(set_questions_api.get_code(), 505404)
     self.assertEqual(set_questions_api.get_response_message(), u'权限不足')
コード例 #3
0
 def test_set_questions_room_id_null(self):
     """
     测试请求接口房间ID为空
     :return:
     """
     set_questions_api = SetQuestionsApi(self.game_anchor_login_name)
     set_questions_api.get({
         'room_id': None,
         'question': self.questions,
         'option_a': self.option_a,
         'option_b': self.option_b
     })
     self.assertEqual(set_questions_api.get_code(), 402000)
     self.assertEqual(set_questions_api.get_response_message(), u'房间ID不能为空')
コード例 #4
0
 def test_set_questions_option_too_long(self):
     """
     测试选项字数超过6个字
     :return:
     """
     set_questions_api = SetQuestionsApi(self.game_anchor_login_name)
     set_questions_api.get({
         'room_id': self.game_room,
         'question': self.questions,
         'option_a': self.option_a * 2 + '1',
         'option_b': self.option_b
     })
     self.assertEqual(set_questions_api.get_code(), 505410)
     self.assertEqual(set_questions_api.get_response_message(),
                      u'输入文字超过规定长度')