def setUp(self): for item in classes: class_ = getattr(models, item) class_.createTable(ifNotExists=True) new_user = models.UserConfig(uuid=123456, login="******", password="******", authId="auth_id") new_user2 = models.UserConfig(uuid=654321, login="******", password="******", authId="auth_id2") new_flow = models.Flow(flowId=123) new_flow2 = models.Flow(flowId=321) models.Message(text="Hello", time=1, userConfig=new_user, flow=new_flow) models.Message(text="Privet", time=2, userConfig=new_user, flow=new_flow) models.Message(text="Hello2", time=3, userConfig=new_user2, flow=new_flow2) self.test = api.ValidJSON.parse_obj(ALL_MESSAGES)
def setUp(self): for item in classes: class_ = getattr(models, item) class_.createTable(ifNotExists=True) new_user1 = models.UserConfig(uuid=123456, login="******", password="******", authId="auth_id") new_user2 = models.UserConfig(uuid=987654, login="******", password="******", authId="auth_id2") new_flow1 = models.Flow(flowId=1, timeCreated=111, flowType='chat', title='title2', info='info2') new_flow2 = models.Flow(flowId=2, timeCreated=222, flowType='chat', title='title2', info='info2') models.Message(text="Hello1", time=111, userConfig=new_user1, flow=new_flow1) models.Message(text="Hello2", time=222, userConfig=new_user2, flow=new_flow2) models.Message(text="Hello3", time=333, userConfig=new_user1, flow=new_flow1) self.test = api.ValidJSON.parse_obj(GET_UPDATE)
def setUp(self): for item in classes: class_ = getattr(models, item) class_.createTable(ifNotExists=True) new_user = models.UserConfig(uuid=123456, login="******", password="******", authId="auth_id") new_flow = models.Flow(flowId=123) models.Message(id=1, text="Hello", time=123456, userConfig=new_user, flow=new_flow) self.test = api.ValidJSON.parse_obj(EDITED_MESSAGE)
def _send_message(self): """The function saves user message in the database. """ try: models.Flow.selectBy(flowId=self.request.data.flow[0].id).getOne() except SQLObjectNotFound as flow_error: self.__catching_error(404, str(flow_error)) else: models.Message( text=self.request.data.message[0].text, time=self.get_time, filePicture=self.request.data.message[0].file_picture, fileVideo=self.request.data.message[0].file_video, fileAudio=self.request.data.message[0].file_audio, fileDocument=self.request.data.message[0].file_audio, emoji=self.request.data.message[0].emoji, editedTime=self.request.data.message[0].edited_time, editedStatus=self.request.data.message[0].edited_status, userConfig=self.request.data.user[0].uuid, flow=self.request.data.flow[0].id) self.__catching_error(200)