Пример #1
0
 def setUp(self):
     BaseTestModel.setUp(self)
     self.chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
     self.message = Message.send(self.chat_id, MESSAGE, MESSAGE_TYPE)
Пример #2
0
 def test_get_tree(self):
     chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
     response = self.app.get(TREE_PAGE_URL.format(chat_id=chat_id))
     self.assertEqual(response.status_code, 200)
Пример #3
0
 def test_get_code(self):
     chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
     code_id = Code.send(chat_id, CODE, 1, COMMIT_MESSAGE)
     response = self.app.get(CODE_GET_PAGE_URL.format(code_id=code_id))
     self.assertEqual(response.status_code, 200)
Пример #4
0
 def test_get_messages(self):
     chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
     response = self.app.get(MESSAGES_GET_PAGE_URL.format(chat_id=chat_id))
     self.assertEqual(response.status_code, 200)
Пример #5
0
 def test_send_message(self):
     chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
     params = {"chat": chat_id, "message": MESSAGE}
     response = self.app.post(MESSAGE_SEND_PAGE_URL, data=params)
     self.assertEqual(response.status_code, 200)
Пример #6
0
 def test_set_chat_name(self):
     chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
     params = {"chat": chat_id, "name": MESSAGE}
     response = self.app.post(SET_CHAT_NAME_PAGE_URL, data=params)
     self.assertEqual(response.status_code, 200)
Пример #7
0
 def test_access_chat_page(self):
     chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
     chat_page_url = CHAT_PAGE_URL.format(chat_id=chat_id)
     response = self.app.get(chat_page_url)
     self.assertEqual(response.status_code, 200)
Пример #8
0
 def test_is_access_key_valid(self):
     chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE, CHAT_ACCESS_KEY)
     chat = Chat.get(chat_id)
     self.assertTrue(chat.is_access_key_valid(CHAT_ACCESS_KEY))
     self.assertFalse(chat.is_access_key_valid(CHAT_INCORRECT_ACCESS_KEY))
Пример #9
0
 def setUp(self):
     BaseTestModel.setUp(self)
     self.chat_id = Chat.create(CHAT_NAME, CHAT_CODE, CODE_TYPE)
Пример #10
0
 def __create_chats(count):
     langs = app.config['ALLOWED_LANGUAGES']
     for i in xrange(count):
         Chat.create('Chat name', 'Chat code',
                     langs[i % len(langs)]['type'])