def test_error_action_2(self): """Тест обработки сообщения если не указан юзер""" self.assertEqual( srv.process_client_message({ 'action': 'presence', 'time': time.time(), }), self.error)
def test_no_user(self): """Ошибка - не указан пользователь""" self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: '1.0' }), self.invalid_response)
def test_no_user(self): """Ошибка - нет пользователя""" self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: '1.1' }), self.err_dict)
def test_no_action(self): self.assertEqual( process_client_message({ TIME: '1.1', USER: { ACCOUNT_NAME: 'Guest' } }), self.err_dict)
def test_ok_msg(self): self.assertEqual(process_client_message({ACTION: MSG, TIME: time.time, FROM: 'Guest', TO: 'server', MESSAGE: 'Привет'} ), self.msg_ok )
def test_without_action(self): self.assertEqual( process_client_message({ TIME: '123.123', USER: { ACCOUNT_NAME: 'Demo' } }), self.error_dict)
def test_without_time(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, USER: { ACCOUNT_NAME: 'Demo' } }), self.error_dict)
def test_no_action(self): self.assertEqual( process_client_message({ TIME: 2.995, USER: { ACCOUNT_NAME: 'User' } }), self.err_massage)
def test_no_time(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, USER: { ACCOUNT_NAME: 'Guest' } }), self.err_dict)
def test_wrong_action(self): self.assertEqual( process_client_message({ ACTION: 'Wrong', TIME: '1.1', USER: { ACCOUNT_NAME: 'Guest' } }), self.err_dict)
def test_ok_check(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: 1.1, USER: { ACCOUNT_NAME: 'Guest' } }), self.ok_dict)
def test_not_ok_user(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: '123.123', USER: { ACCOUNT_NAME: 'TestNotOkUser' } }), self.error_dict)
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)
def test_ok_message(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: '123.123', USER: { ACCOUNT_NAME: 'Demo' } }), self.ok_dict)
def test_msg_ok(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: 2.995, USER: { ACCOUNT_NAME: 'User' } }), self.msg_ok)
def test_unknown_user(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: 1.1, USER: { ACCOUNT_NAME: 'Guest1' } }), self.err_dict)
def test_all_is_fine(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: TEST_TIME, USER: { ACCOUNT_NAME: DEF_USER } }), RESP_OK)
def test_no_action(self): """Ошибка если нет действия""" self.assertEqual( process_client_message({ TIME: '1.1', USER: { ACCOUNT_NAME: 'Guest' } }), self.err_dict)
def test_no_action_wrong_ans(self): """Ошибка если нет действия""" self.assertNotEqual( process_client_message({ TIME: '0', USER: { LOGIN: '******' } }), self.ok_dict)
def test_no_time(self): """Ошибка, если запрос не содержит штампа времени""" self.assertEqual( process_client_message({ ACTION: PRESENCE, USER: { ACCOUNT_NAME: 'Guest' } }), self.err_dict)
def test_error_action_0(self): """Тест обработки сообщения если не указано действие""" self.assertEqual( srv.process_client_message({ 'time': time.time(), 'user': { 'account_name': 'Guest' } }), self.error)
def test_not_correct_name(self): self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: 2.995, USER: { ACCOUNT_NAME: 'Guest' } }), self.err_massage)
def test_no_time(self): """Ошибка - нет времени сообщения""" self.assertEqual( process_client_message({ ACTION: PRESENCE, USER: { ACCOUNT_NAME: 'Guest' } }), self.invalid_response)
def test_no_action(self): """Ошибка - нет типа сообщения""" self.assertEqual( process_client_message({ TIME: '1.0', USER: { ACCOUNT_NAME: 'Guest' } }), self.invalid_response)
def test_unknown_user(self): """Ошибка - не Guest""" self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: 1.1, USER: { ACCOUNT_NAME: 'User' } }), self.invalid_response)
def test_invalid_action(self): """Ошибка - неизвестный тип сообщения""" self.assertEqual( process_client_message({ ACTION: 'request', TIME: '1.1', USER: { ACCOUNT_NAME: 'Guest' } }), self.invalid_response)
def test_error_action_3(self): """Тест обработки сообщения если не корректное имя юзера""" self.assertEqual( srv.process_client_message({ 'action': 'null', 'time': time.time(), 'user': { 'account_name': 'Tom' } }), self.error)
def test_smoke_check(self): """Тест на 'дымок'""" self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: 1.1, USER: { ACCOUNT_NAME: 'Guest' } }), self.valid_response)
def test_wrong_action(self): """Ошибка если неизвестное действие""" self.assertEqual( process_client_message({ ACTION: 'Wrong', TIME: '1.1', USER: { ACCOUNT_NAME: 'Guest' } }), self.err_dict)
def test_wrong_time(self): """Ошибка, если формат времени не верен""" self.assertEqual( process_client_message({ ACTION: PRESENCE, TIME: 'abc', USER: { ACCOUNT_NAME: 'Guest' } }), self.err_dict)