Files
electric-vehicle-battery-ch…/test/__init__.py
2023-05-18 18:21:00 -04:00

24 lines
434 B
Python

import os
import tempfile
import pytest
from app import create_app, db, Vehicle
from flask import json
@pytest.fixture
def client():
app = create_app()
db_fd, app.config['DATABASE'] = tempfile.mkstemp()
app.config['TESTING'] = True
client = app.test_client()
with app.app_context():
db.drop_all()
db.create_all()
yield client
os.close(db_fd)
os.unlink(app.config['DATABASE'])