26 lines
699 B
Python
26 lines
699 B
Python
|
import pytest
|
||
|
import shutil
|
||
|
from pathlib import Path
|
||
|
from app import create_app
|
||
|
|
||
|
@pytest.fixture()
|
||
|
def app():
|
||
|
app = create_app()
|
||
|
# Copy the sample to the test folder using python
|
||
|
shutil.copy(Path(__file__).parent.parent / 'sample' / 'medailles.json', Path(__file__).parent / 'tests' / 'medailles.json')
|
||
|
app.config.update({
|
||
|
"TESTING": True,
|
||
|
"MEDAILLE_FILE": Path(__file__).parent / 'tests' / 'medailles.json'
|
||
|
})
|
||
|
yield app
|
||
|
|
||
|
# Remove the file after the test
|
||
|
(Path(__file__).parent / 'tests' / 'medailles.json').unlink()
|
||
|
|
||
|
@pytest.fixture()
|
||
|
def client(app):
|
||
|
return app.test_client()
|
||
|
|
||
|
@pytest.fixture()
|
||
|
def runner(app):
|
||
|
return app.test_cli_runner()
|