From 6cd13c9b56e0a96d029e8ac0305b8c945ee80937 Mon Sep 17 00:00:00 2001 From: Simon Kelly Date: Tue, 8 May 2018 09:30:46 +0200 Subject: [PATCH] add test for existing table --- tests/conftest.py | 3 ++- tests/test_checkpointmanager.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0a35d992..47257688 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,9 +13,10 @@ logging.getLogger().setLevel(logging.DEBUG) logging.getLogger().addHandler(logging.StreamHandler()) + @pytest.fixture(scope="class", params=[ { - 'url': "postgresql://postgres@/%s", + 'url': "postgresql://postgres@localhost/%s", 'admin_db': 'postgres' }, { diff --git a/tests/test_checkpointmanager.py b/tests/test_checkpointmanager.py index d087ef2b..29c6b425 100644 --- a/tests/test_checkpointmanager.py +++ b/tests/test_checkpointmanager.py @@ -26,6 +26,12 @@ def test_create_checkpoint_table(self, manager): with manager: assert 'commcare_export_runs' in manager.metadata.tables + def test_checkpoint_table_exists(self, manager): + self.test_create_checkpoint_table(manager) + with manager: + manager.connection.execute(manager.sqlalchemy.sql.text('DROP TABLE alembic_version')) + manager.create_checkpoint_table() + def test_get_time_of_last_run(self, manager): manager.create_checkpoint_table() with manager: