Skip to content

Commit

Permalink
test for connection param from yaml is almost ready
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Sep 18, 2024
1 parent 8eb3568 commit d6bc1a5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
28 changes: 27 additions & 1 deletion tests/conftest.py
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
6 changes: 5 additions & 1 deletion tests/test_connection.py
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

0 comments on commit d6bc1a5

Please sign in to comment.