コード例 #1
0
 def test_error_action_2(self):
     """Тест обработки сообщения если не указан юзер"""
     self.assertEqual(
         srv.process_client_message({
             'action': 'presence',
             'time': time.time(),
         }), self.error)
コード例 #2
0
 def test_no_user(self):
     """Ошибка - не указан пользователь"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: '1.0'
         }), self.invalid_response)
コード例 #3
0
 def test_no_user(self):
     """Ошибка - нет пользователя"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: '1.1'
         }), self.err_dict)
コード例 #4
0
 def test_no_action(self):
     self.assertEqual(
         process_client_message({
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
コード例 #5
0
 def test_ok_msg(self):
     self.assertEqual(process_client_message({ACTION: MSG,
                                              TIME: time.time,
                                              FROM: 'Guest',
                                              TO: 'server',
                                              MESSAGE: 'Привет'}
                                             ), self.msg_ok
                      )
コード例 #6
0
 def test_without_action(self):
     self.assertEqual(
         process_client_message({
             TIME: '123.123',
             USER: {
                 ACCOUNT_NAME: 'Demo'
             }
         }), self.error_dict)
コード例 #7
0
 def test_without_time(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Demo'
             }
         }), self.error_dict)
コード例 #8
0
 def test_no_action(self):
     self.assertEqual(
         process_client_message({
             TIME: 2.995,
             USER: {
                 ACCOUNT_NAME: 'User'
             }
         }), self.err_massage)
コード例 #9
0
 def test_no_time(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
コード例 #10
0
 def test_wrong_action(self):
     self.assertEqual(
         process_client_message({
             ACTION: 'Wrong',
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
コード例 #11
0
 def test_ok_check(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 1.1,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.ok_dict)
コード例 #12
0
 def test_not_ok_user(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: '123.123',
             USER: {
                 ACCOUNT_NAME: 'TestNotOkUser'
             }
         }), self.error_dict)
コード例 #13
0
 def test_wrong_action(self):
     self.assertEqual(
         process_client_message({
             ACTION: 'test_not_ok_action',
             TIME: '123.123',
             USER: {
                 ACCOUNT_NAME: 'Demo'
             }
         }), self.error_dict)
コード例 #14
0
 def test_ok_message(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: '123.123',
             USER: {
                 ACCOUNT_NAME: 'Demo'
             }
         }), self.ok_dict)
コード例 #15
0
 def test_msg_ok(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 2.995,
             USER: {
                 ACCOUNT_NAME: 'User'
             }
         }), self.msg_ok)
コード例 #16
0
 def test_unknown_user(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 1.1,
             USER: {
                 ACCOUNT_NAME: 'Guest1'
             }
         }), self.err_dict)
コード例 #17
0
 def test_all_is_fine(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: TEST_TIME,
             USER: {
                 ACCOUNT_NAME: DEF_USER
             }
         }), RESP_OK)
コード例 #18
0
 def test_no_action(self):
     """Ошибка если нет действия"""
     self.assertEqual(
         process_client_message({
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
コード例 #19
0
 def test_no_action_wrong_ans(self):
     """Ошибка если нет действия"""
     self.assertNotEqual(
         process_client_message({
             TIME: '0',
             USER: {
                 LOGIN: '******'
             }
         }), self.ok_dict)
コード例 #20
0
 def test_no_time(self):
     """Ошибка, если  запрос не содержит штампа времени"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
コード例 #21
0
 def test_error_action_0(self):
     """Тест обработки сообщения если не указано действие"""
     self.assertEqual(
         srv.process_client_message({
             'time': time.time(),
             'user': {
                 'account_name': 'Guest'
             }
         }), self.error)
コード例 #22
0
 def test_not_correct_name(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 2.995,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_massage)
コード例 #23
0
 def test_no_time(self):
     """Ошибка - нет времени сообщения"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.invalid_response)
コード例 #24
0
 def test_no_action(self):
     """Ошибка - нет типа сообщения"""
     self.assertEqual(
         process_client_message({
             TIME: '1.0',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.invalid_response)
コード例 #25
0
 def test_unknown_user(self):
     """Ошибка - не Guest"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 1.1,
             USER: {
                 ACCOUNT_NAME: 'User'
             }
         }), self.invalid_response)
コード例 #26
0
 def test_invalid_action(self):
     """Ошибка - неизвестный тип сообщения"""
     self.assertEqual(
         process_client_message({
             ACTION: 'request',
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.invalid_response)
コード例 #27
0
 def test_error_action_3(self):
     """Тест обработки сообщения если не корректное имя юзера"""
     self.assertEqual(
         srv.process_client_message({
             'action': 'null',
             'time': time.time(),
             'user': {
                 'account_name': 'Tom'
             }
         }), self.error)
コード例 #28
0
 def test_smoke_check(self):
     """Тест на 'дымок'"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 1.1,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.valid_response)
コード例 #29
0
 def test_wrong_action(self):
     """Ошибка если неизвестное действие"""
     self.assertEqual(
         process_client_message({
             ACTION: 'Wrong',
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
コード例 #30
0
 def test_wrong_time(self):
     """Ошибка, если формат времени не верен"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 'abc',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)