-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update docs * Update tests * Update config * Added Github Action badge * Update travis conf
- Loading branch information
Showing
9 changed files
with
146 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
from manage import create_app | ||
from project.models.init_db import db as _db | ||
|
||
|
||
def conf_environment(): | ||
if not os.environ.get("CONFIGMAP_FILE", False): | ||
os.environ["CONFIGMAP_FILE"] = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config-tests.yml") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def app(): | ||
conf_environment() | ||
app = create_app() | ||
return app | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def client(app, db): | ||
"""A test client for the app.""" | ||
return app.test_client() | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def base_url(app): | ||
"""Base url of the service.""" | ||
return app.config["APPLICATION_ROOT"] | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def db(app, request): | ||
def teardown(): | ||
_db.drop_all() | ||
|
||
_db.app = app | ||
_db.init_app(app) | ||
_db.create_all() | ||
|
||
request.addfinalizer(teardown) | ||
|
||
return _db | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def db_handler(app_handler, request): | ||
def teardown(): | ||
_db.drop_all() | ||
|
||
_db.app = app_handler | ||
_db.init_app(app_handler) | ||
_db.create_all() | ||
|
||
request.addfinalizer(teardown) | ||
|
||
return _db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters