-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move get_test_dbconf to be a shared test helper. use in both metadata…
… and ui_backend service tests
- Loading branch information
1 parent
74bea7c
commit a065407
Showing
3 changed files
with
20 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from services.utils import DBConfiguration | ||
import pytest | ||
|
||
|
||
def get_test_dbconf(): | ||
""" | ||
Returns a DBConfiguration suitable for the test environment, or exits pytest completely upon failure | ||
""" | ||
db_conf = DBConfiguration(timeout=1) | ||
|
||
if db_conf.dsn != "dbname=test user=test host=db_test port=5432 password=test": | ||
pytest.exit("The test suite should only be run in a test environment. \n \ | ||
Configured database host is not suited for running tests. \n \ | ||
expected DSN to be: dbname=test user=test host=db_test port=5432 password=test") | ||
|
||
return db_conf |