def setUp(self): super().setUp() os.environ['AUTHENTICATE'] = "YES" self.app = create_app(self.db_session, self.engine) self.client = self.app.app.test_client() self.posicaolote = { "IDEvento": 42, "dataevento": "2019-06-14T11:18:43.287Z", "dataregistro": "2019-06-14T11:18:43.287Z", "operadorevento": "string", "operadorregistro": "string", "retificador": False, "numerolote": 0, "posicao": "string", "qtdevolumes": "string" }
def setUp(self): super().setUp() app = create_app(self.db_session, self.engine) self.client = app.app.test_client() self.inspecao_modelo = { "IDEvento": 1001, "dataevento": "2019-05-28T12:18:41.204Z", "dataregistro": "2019-05-28T12:18:41.204Z", "operadorevento": "string", "operadorregistro": "string", "anexos": [{ "nomearquivo": "", "content": "", "contentType": "", "datacriacao": "2019-05-31T02:55:50.300000Z", "datamodificacao": "2019-05-31T02:55:50.300000Z" }], "identificadores": [{ "identificador": "string" }], "retificador": False, "capturaautomatica": True, "documentotransporte": "150", "numero": "TESTE1234", "placa": "TST1234", "placasemireboque": "TST5678", "tipodocumentotransporte": "CE" } images_dir = os.path.join(os.getcwd(), 'tests', 'images') self.filename = os.listdir(images_dir)[0] self.image = open(os.path.join(images_dir, self.filename), 'rb') self.base64_bytes = b64encode(self.image.read()) # base64_string = base64_bytes.decode('utf-8') self.file = (BytesIO(self.base64_bytes), self.filename) self.get_token()
import sys from apiserver.models import orm sys.path.insert(0, './apiserver') from apiserver.main import create_app session, engine = orm.init_db() #'sqlite:///:memory:') orm.Base.metadata.drop_all(bind=engine) orm.Base.metadata.create_all(bind=engine) app = create_app(session, engine) if __name__ == '__main__': app.run(port=8000, threaded=False, debug=True)
def setUp(self): super().setUp() app = create_app(self.db_session, self.engine) self.client = app.app.test_client() self.get_token()