Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #560 from okfn/560-datastore-tests
Datastore tests aren't respecting the legacy_mode flag, index creation does not work on PG 8.4
- Loading branch information
Showing
5 changed files
with
110 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import unittest | ||
|
||
import ckanext.datastore.plugin as plugin | ||
|
||
|
||
class TestTypeGetters(unittest.TestCase): | ||
def setUp(self): | ||
self.p = plugin.DatastorePlugin() | ||
|
||
def test_legacy_mode_default(self): | ||
assert not self.p.legacy_mode | ||
|
||
def test_set_legacy_mode(self): | ||
assert not self.p.legacy_mode | ||
c = { | ||
'sqlalchemy.url': 'bar', | ||
'ckan.datastore.write_url': 'foo' | ||
} | ||
try: | ||
self.p.configure(c) | ||
except Exception: | ||
pass | ||
assert self.p.legacy_mode | ||
assert self.p.write_url == 'foo' | ||
assert self.p.read_url == 'foo' | ||
|
||
def test_check_separate_db(self): | ||
self.p.write_url = 'postgresql://u:pass@localhost/dt' | ||
self.p.read_url = 'postgresql://u:pass@localhost/dt' | ||
self.p.ckan_url = 'postgresql://u:pass@localhost/ckan' | ||
|
||
self.p.legacy_mode = True | ||
try: | ||
self.p._check_separate_db() | ||
except Exception: | ||
self.fail("_check_separate_db raise Exception unexpectedly!") | ||
|
||
self.p.legacy_mode = False | ||
self.assertRaises(Exception, self.p._check_separate_db) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters