Merge pull request #210 from jmagnusson/use-test-user-in-postgres-template-tests

Use the `postgresql_db_user` fixture in test_template tests
This commit is contained in:
Konsta Vesterinen
2016-04-15 14:06:45 +03:00

View File

@@ -63,7 +63,7 @@ class TestDatabasePostgres(DatabaseTest):
def db_name(self): def db_name(self):
return 'db_test_sqlalchemy_util' return 'db_test_sqlalchemy_util'
def test_template(self): def test_template(self, postgresql_db_user):
( (
flexmock(sa.engine.Engine) flexmock(sa.engine.Engine)
.should_receive('execute') .should_receive('execute')
@@ -72,10 +72,10 @@ class TestDatabasePostgres(DatabaseTest):
"TEMPLATE my_template" "TEMPLATE my_template"
) )
) )
create_database( dsn = 'postgres://{0}@localhost/db_test_sqlalchemy_util'.format(
'postgres://postgres@localhost/db_test_sqlalchemy_util', postgresql_db_user
template='my_template'
) )
create_database(dsn, template='my_template')
@pytest.mark.usefixtures('postgresql_dsn') @pytest.mark.usefixtures('postgresql_dsn')
@@ -85,7 +85,7 @@ class TestDatabasePostgresWithQuotedName(DatabaseTest):
def db_name(self): def db_name(self):
return 'db_test_sqlalchemy-util' return 'db_test_sqlalchemy-util'
def test_template(self): def test_template(self, postgresql_db_user):
( (
flexmock(sa.engine.Engine) flexmock(sa.engine.Engine)
.should_receive('execute') .should_receive('execute')
@@ -95,7 +95,7 @@ class TestDatabasePostgresWithQuotedName(DatabaseTest):
'TEMPLATE "my-template"' 'TEMPLATE "my-template"'
) )
) )
create_database( dsn = 'postgres://{0}@localhost/db_test_sqlalchemy-util'.format(
'postgres://postgres@localhost/db_test_sqlalchemy-util', postgresql_db_user
template='my-template'
) )
create_database(dsn, template='my-template')