Skip to content

Commit

Permalink
added test cases for keywords and connection strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Karstens committed Mar 26, 2015
1 parent 6c7d0da commit e23c964
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/test_exadialect_pyodbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ def test_create_connect_args(self):
['DRIVER={EXAODBC};EXAHOST=192.168.1.2..8:1234;EXASCHEMA=my_schema;UID=scott;PWD=tiger;INTTYPESINRESULTSIFPOSSIBLE=y'],
{})

def test_create_connect_args_with_driver(self):
self.assert_parsed("exa+pyodbc://scott:tiger@192.168.1.2..8:1234/my_schema?driver=FOOBAR",
['DRIVER={FOOBAR};EXAHOST=192.168.1.2..8:1234;EXASCHEMA=my_schema;UID=scott;PWD=tiger;INTTYPESINRESULTSIFPOSSIBLE=y'],
{})

def test_create_connect_args_dsn(self):
self.assert_parsed("exa+pyodbc://scott:tiger@exa_test",
['DSN=exa_test;UID=scott;PWD=tiger;INTTYPESINRESULTSIFPOSSIBLE=y'],
{})

def test_create_connect_args_trusted(self):
self.assert_parsed("exa+pyodbc://192.168.1.2..8:1234/my_schema",
Expand All @@ -48,8 +57,8 @@ def test_create_connect_args_with_param_multiple(self):
{'AUTOCOMMIT': True, 'ANSI': False, 'UNICODE_RESULTS': False})



def test_create_connect_args_with_unknown_params(self):
self.assert_parsed("exa+pyodbc://scott:tiger@192.168.1.2..8:1234/my_schema?clientname=test&querytimeout=10",
['DRIVER={EXAODBC};EXAHOST=192.168.1.2..8:1234;EXASCHEMA=my_schema;UID=scott;PWD=tiger;INTTYPESINRESULTSIFPOSSIBLE=y;clientname=test;querytimeout=10'],
{})

11 changes: 11 additions & 0 deletions test/test_exasol.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import datetime

from sqlalchemy_exasol.base import RESERVED_WORDS
from sqlalchemy_exasol.merge import merge
from sqlalchemy_exasol.constraints import DistributeByConstraint

Expand Down Expand Up @@ -242,6 +243,16 @@ def test_insert_with_default_value(self):
(_, _, active_from) = config.db.execute(t.select()).fetchone()
assert active_from == datetime.date(1900, 1, 1)

class KeywordTest(fixtures.TablesTest):

__backend__ = True

def test_keywords(self):
keywords = config.db.execute('select distinct(lower(keyword)) as keyword ' +
'from SYS.EXA_SQL_KEYWORDS where reserved = True order by keyword').fetchall()
db_keywords = set([k[0] for k in keywords])
assert db_keywords <= RESERVED_WORDS

class ConstraintsTest(fixtures.TablesTest):
__backend__ = True

Expand Down

0 comments on commit e23c964

Please sign in to comment.