def test_change_file(container_node): from core import File node = container_node d = File(path=u"test", filetype=u"test", mimetype=u"test") node.files.append(d) db.session.commit() d.path = u"changed" db.session.commit() # Changing the current file affects only the current node's File, not the node version's File. assert node.versions[0].files.one().path == u"test" assert node.files.one().path == u"changed" assert node.versions[-1].next is None
def transribe_job(filename: str, accent: str, socket_id: str): try: file_path = File.path(filename) transcriber = Transcriber(file_path, accent) message = transcriber.run() ctx = {'message': message, 'status': Status.SUCCESS.value} asyncio.run( socket.emit(event=SocketMessage.TRANSCRIBE.value, data=ctx, sid=socket_id)) except Exception as error: ctx = {'message': str(error), 'status': Status.ERROR.value} asyncio.run( socket.emit(event=SocketMessage.STATUS.value, data=ctx, sid=socket_id)) finally: File.delete(filename) root = filename.split('.')[0] File.delete(f'{root}.wav')