Skip to content

Commit

Permalink
[#560] Test pg version comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Mar 7, 2013
1 parent 753a1f3 commit ea9a201
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ckanext/datastore/tests/test_unit.py
@@ -1,5 +1,8 @@
import unittest
import pylons
import nose

import ckan.tests as tests
import ckanext.datastore.db as db


Expand Down Expand Up @@ -49,3 +52,12 @@ def test_is_valid_table_name(self):
assert db._is_valid_table_name("'")
assert not db._is_valid_table_name("")
assert not db._is_valid_table_name("foo%bar")

def test_pg_version_check(self):
if not tests.is_datastore_supported():
raise nose.SkipTest("Datastore not supported")
engine = db._get_engine(None,
{'connection_url': pylons.config['sqlalchemy.url']})
connection = engine.connect()
assert db._pg_version_is_at_least(connection, '8.0')
assert not db._pg_version_is_at_least(connection, '10.0')

0 comments on commit ea9a201

Please sign in to comment.