-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test for connection param from yaml is almost ready
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
import os | ||
import pytest | ||
import yaml | ||
|
||
@pytest.fixture | ||
def dummy_connection_config(): | ||
def testtmp(tmpdir_factory): | ||
|
||
return tmpdir_factory.mktemp('omnipath-metabo-tests') | ||
|
||
@pytest.fixture | ||
def dummy_con_param(): | ||
|
||
return { | ||
'user': 'testuser', | ||
'password': 'testpw', | ||
'host': 'myhost', | ||
'port': 5432, | ||
'database': 'testdb', | ||
} | ||
|
||
|
||
|
||
@pytest.fixture | ||
def dummy_connection_config(testtmp, dummy_con_param): | ||
|
||
path = os.path.join(testtmp, 'config.yaml') | ||
|
||
with open(path, 'w') as fp: | ||
|
||
fp.write(yaml.dump(dummy_con_param)) | ||
|
||
return path |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
from omnipath_metabo.schema import _connection | ||
|
||
def test_param_yaml(): | ||
def test_param_yaml(dummy_connection_config, dummy_con_param): | ||
|
||
con = _connection.Connection(dummy_connection_config) | ||
|
||
assert con._param == dummy_con_param |