parent
5b309831ec
commit
025589ee76
63 changed files with 3784 additions and 3459 deletions
|
|
@ -6,8 +6,8 @@ from flaskr import create_app
|
|||
from flaskr.db import get_db, init_db
|
||||
|
||||
# read in SQL for populating test data
|
||||
with open(os.path.join(os.path.dirname(__file__), 'data.sql'), 'rb') as f:
|
||||
_data_sql = f.read().decode('utf8')
|
||||
with open(os.path.join(os.path.dirname(__file__), "data.sql"), "rb") as f:
|
||||
_data_sql = f.read().decode("utf8")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -16,10 +16,7 @@ def app():
|
|||
# create a temporary file to isolate the database for each test
|
||||
db_fd, db_path = tempfile.mkstemp()
|
||||
# create the app with common test config
|
||||
app = create_app({
|
||||
'TESTING': True,
|
||||
'DATABASE': db_path,
|
||||
})
|
||||
app = create_app({"TESTING": True, "DATABASE": db_path})
|
||||
|
||||
# create the database and load test data
|
||||
with app.app_context():
|
||||
|
|
@ -49,14 +46,13 @@ class AuthActions(object):
|
|||
def __init__(self, client):
|
||||
self._client = client
|
||||
|
||||
def login(self, username='test', password='test'):
|
||||
def login(self, username="test", password="test"):
|
||||
return self._client.post(
|
||||
'/auth/login',
|
||||
data={'username': username, 'password': password}
|
||||
"/auth/login", data={"username": username, "password": password}
|
||||
)
|
||||
|
||||
def logout(self):
|
||||
return self._client.get('/auth/logout')
|
||||
return self._client.get("/auth/logout")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue