Skip to content

Commit

Permalink
check that environment variables can be used
Browse files Browse the repository at this point in the history
  • Loading branch information
segasai committed Jul 7, 2022
1 parent e0b67f4 commit 4cd4ad0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/sqlutil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def getconn():


class TestPostgres:

def setup(self):
conn = psycopg2.connect('dbname=%s user=%s host=%s password=%s' %
(PG_DB, PG_USER, PG_HOST, PG_PASS))
Expand Down Expand Up @@ -72,6 +73,15 @@ def test_getConn(self):
driver='psycopg2')
conn.close()
pass

def test_getConnEnv(self):
os.environ['PGHOST'] = PG_HOST
os.environ['PGUSER'] = PG_USER
os.environ['PGDATABASE'] = PG_DB
conn = sqlutil.getConnection(driver='psycopg2', password=PG_PASS)
conn.close()
pass

def test_getConnWithPort(self):
conn = sqlutil.getConnection(host=PG_HOST,
user=PG_USER,
Expand Down Expand Up @@ -356,6 +366,7 @@ def test_upload(self):


class TestSQLite:

def setup(self):
self.fname = 'sql.db'
self.kw = dict(db=self.fname, driver='sqlite3')
Expand Down

0 comments on commit 4cd4ad0

Please sign in to comment.