Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_db_params_repr():
"""Test DbParams string representation"""
test_params = DbParams(
dbtype='PG',
host='localhost',
port=5432,
dbname='etlhelper',
user='etlhelper_user')
result = str(test_params)
expected = ("DbParams(host='localhost', "
"port='5432', dbname='etlhelper', "
"user='etlhelper_user', dbtype='PG')")
assert result == expected
def test_db_params_copy():
"""
Test db_params can copy themselves.
"""
# Arrange
test_params = DbParams(
dbtype='PG',
host='localhost',
port=5432,
dbname='etlhelper',
user='etlhelper_user')
# Act
test_params2 = test_params.copy()
# Assert
assert test_params2 == test_params
assert test_params2 is not test_params
assert isinstance(test_params2, DbParams)
def test_db_params_validate_params():
with pytest.raises(ETLHelperDbParamsError, match=r'.* not in valid types .*'):
DbParams(dbtype='not valid')