From 6717440f2efb380e9a1749ca5679ec9eae0e1e06 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Thu, 28 Mar 2013 12:41:50 +0100 Subject: [PATCH] [#642] Fix how the check for separate urls is ignored in legacy mode. I put the check for the legacy mode in this function to make it testable. --- ckanext/datastore/plugin.py | 3 ++- ckanext/datastore/tests/test_configure.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ckanext/datastore/plugin.py b/ckanext/datastore/plugin.py index 9d696181d67..c7b7566aad4 100644 --- a/ckanext/datastore/plugin.py +++ b/ckanext/datastore/plugin.py @@ -143,8 +143,9 @@ def _get_db_from_url(self, url): def _same_read_and_write_url(self): # in legacy mode, this test can be ignored + # because both URLs are set to the same url if self.legacy_mode: - return True + return False return self.write_url == self.read_url def _read_connection_has_correct_privileges(self): diff --git a/ckanext/datastore/tests/test_configure.py b/ckanext/datastore/tests/test_configure.py index a5f1dd24d21..09d7253fcec 100644 --- a/ckanext/datastore/tests/test_configure.py +++ b/ckanext/datastore/tests/test_configure.py @@ -28,7 +28,7 @@ def test_check_separate_write_and_read_if_not_legacy(self): self.p.legacy_mode = True self.p.write_url = 'postgresql://u:pass@localhost/ds' self.p.read_url = 'postgresql://u:pass@localhost/ds' - assert self.p._same_read_and_write_url() + assert not self.p._same_read_and_write_url() self.p.legacy_mode = False