From 6b95fc966d31a2d2149d3f9a628742c53de8d373 Mon Sep 17 00:00:00 2001 From: Jacob Magnusson Date: Fri, 15 Apr 2016 13:01:48 +0200 Subject: [PATCH] =?UTF-8?q?Use=20the=20postgresql=5Fdb=5Fuser=20user=20nam?= =?UTF-8?q?e=20in=20test=5Ftemplate=20tests=20Before=20it=20was=20hard-cod?= =?UTF-8?q?ed=20to=20the=20`postgres`=20user.=20I=E2=80=99m=20not=20quite?= =?UTF-8?q?=20sure=20why=20these=20tests=20failed=20for=20me,=20considerin?= =?UTF-8?q?g=20that=20the=20calls=20to=20the=20engine=20should=20be=20mock?= =?UTF-8?q?ed.=20Perhaps=20a=20new=20version=20of=20`flexmock`=20has=20cha?= =?UTF-8?q?nged=20something.=20Downgrading=20SQLAlchemy=20did=20not=20help?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/functions/test_database.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/functions/test_database.py b/tests/functions/test_database.py index 9ddf73b..33173cf 100644 --- a/tests/functions/test_database.py +++ b/tests/functions/test_database.py @@ -63,7 +63,7 @@ class TestDatabasePostgres(DatabaseTest): def db_name(self): return 'db_test_sqlalchemy_util' - def test_template(self): + def test_template(self, postgresql_db_user): ( flexmock(sa.engine.Engine) .should_receive('execute') @@ -72,10 +72,10 @@ class TestDatabasePostgres(DatabaseTest): "TEMPLATE my_template" ) ) - create_database( - 'postgres://postgres@localhost/db_test_sqlalchemy_util', - template='my_template' + dsn = 'postgres://{0}@localhost/db_test_sqlalchemy_util'.format( + postgresql_db_user ) + create_database(dsn, template='my_template') @pytest.mark.usefixtures('postgresql_dsn') @@ -85,7 +85,7 @@ class TestDatabasePostgresWithQuotedName(DatabaseTest): def db_name(self): return 'db_test_sqlalchemy-util' - def test_template(self): + def test_template(self, postgresql_db_user): ( flexmock(sa.engine.Engine) .should_receive('execute') @@ -95,7 +95,7 @@ class TestDatabasePostgresWithQuotedName(DatabaseTest): 'TEMPLATE "my-template"' ) ) - create_database( - 'postgres://postgres@localhost/db_test_sqlalchemy-util', - template='my-template' + dsn = 'postgres://{0}@localhost/db_test_sqlalchemy-util'.format( + postgresql_db_user ) + create_database(dsn, template='my-template')