Exemplo n.º 1
0
 def test_error_action_2(self):
     """Тест обработки сообщения если не указан юзер"""
     self.assertEqual(
         srv.process_client_message({
             'action': 'presence',
             'time': time.time(),
         }), self.error)
Exemplo n.º 2
0
 def test_no_user(self):
     """Ошибка - не указан пользователь"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: '1.0'
         }), self.invalid_response)
Exemplo n.º 3
0
 def test_no_user(self):
     """Ошибка - нет пользователя"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: '1.1'
         }), self.err_dict)
Exemplo n.º 4
0
 def test_no_action(self):
     self.assertEqual(
         process_client_message({
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
Exemplo n.º 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
                      )
Exemplo n.º 6
0
 def test_without_action(self):
     self.assertEqual(
         process_client_message({
             TIME: '123.123',
             USER: {
                 ACCOUNT_NAME: 'Demo'
             }
         }), self.error_dict)
Exemplo n.º 7
0
 def test_without_time(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Demo'
             }
         }), self.error_dict)
Exemplo n.º 8
0
 def test_no_action(self):
     self.assertEqual(
         process_client_message({
             TIME: 2.995,
             USER: {
                 ACCOUNT_NAME: 'User'
             }
         }), self.err_massage)
Exemplo n.º 9
0
 def test_no_time(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
Exemplo n.º 10
0
 def test_wrong_action(self):
     self.assertEqual(
         process_client_message({
             ACTION: 'Wrong',
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
Exemplo n.º 11
0
 def test_ok_check(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 1.1,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.ok_dict)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 14
0
 def test_ok_message(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: '123.123',
             USER: {
                 ACCOUNT_NAME: 'Demo'
             }
         }), self.ok_dict)
Exemplo n.º 15
0
 def test_msg_ok(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 2.995,
             USER: {
                 ACCOUNT_NAME: 'User'
             }
         }), self.msg_ok)
Exemplo n.º 16
0
 def test_unknown_user(self):
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 1.1,
             USER: {
                 ACCOUNT_NAME: 'Guest1'
             }
         }), self.err_dict)
Exemplo n.º 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)
Exemplo n.º 18
0
 def test_no_action(self):
     """Ошибка если нет действия"""
     self.assertEqual(
         process_client_message({
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
Exemplo n.º 19
0
 def test_no_action_wrong_ans(self):
     """Ошибка если нет действия"""
     self.assertNotEqual(
         process_client_message({
             TIME: '0',
             USER: {
                 LOGIN: '******'
             }
         }), self.ok_dict)
Exemplo n.º 20
0
 def test_no_time(self):
     """Ошибка, если  запрос не содержит штампа времени"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
Exemplo n.º 21
0
 def test_error_action_0(self):
     """Тест обработки сообщения если не указано действие"""
     self.assertEqual(
         srv.process_client_message({
             'time': time.time(),
             'user': {
                 'account_name': 'Guest'
             }
         }), self.error)
Exemplo n.º 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)
Exemplo n.º 23
0
 def test_no_time(self):
     """Ошибка - нет времени сообщения"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.invalid_response)
Exemplo n.º 24
0
 def test_no_action(self):
     """Ошибка - нет типа сообщения"""
     self.assertEqual(
         process_client_message({
             TIME: '1.0',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.invalid_response)
Exemplo n.º 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)
Exemplo n.º 26
0
 def test_invalid_action(self):
     """Ошибка - неизвестный тип сообщения"""
     self.assertEqual(
         process_client_message({
             ACTION: 'request',
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.invalid_response)
Exemplo n.º 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)
Exemplo n.º 28
0
 def test_smoke_check(self):
     """Тест на 'дымок'"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 1.1,
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.valid_response)
Exemplo n.º 29
0
 def test_wrong_action(self):
     """Ошибка если неизвестное действие"""
     self.assertEqual(
         process_client_message({
             ACTION: 'Wrong',
             TIME: '1.1',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)
Exemplo n.º 30
0
 def test_wrong_time(self):
     """Ошибка, если формат времени не верен"""
     self.assertEqual(
         process_client_message({
             ACTION: PRESENCE,
             TIME: 'abc',
             USER: {
                 ACCOUNT_NAME: 'Guest'
             }
         }), self.err_dict)