From 7265e6df7e7ae830964d7a39b9ec6e84de41e54b Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Sat, 9 Oct 2010 18:03:05 +0200 Subject: added dbutils tests --- dbutils.py | 5 +++-- dbutils_test.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 dbutils_test.py diff --git a/dbutils.py b/dbutils.py index 2dd8e66..31d56ab 100644 --- a/dbutils.py +++ b/dbutils.py @@ -1,10 +1,11 @@ import cx_Oracle import dbconfig -connStr = '%s/%s@%s' % (dbconfig.USER, dbconfig.PASS, dbconfig.SID) +CONN_STR = '%s/%s@%s' % (dbconfig.USER, dbconfig.PASS, dbconfig.SID) def get_tables(): - with cx_Oracle.connect(connStr) as conn: + with cx_Oracle.connect(CONN_STR) as conn: cur = conn.cursor() cur.execute('SELECT owner, table_name FROM all_tables') return [table for owner, table in cur.fetchall()] + diff --git a/dbutils_test.py b/dbutils_test.py new file mode 100644 index 0000000..ba4d6bb --- /dev/null +++ b/dbutils_test.py @@ -0,0 +1,15 @@ +import unittest + +import dbutils + +class DBUtilsTest(unittest.TestCase): + + def setUp(self): + self.seq = range(10) + + def test_get_tables(self): + tables = dbutils.get_tables() + self.assertTrue(len(tables) >= 1) + +if __name__ == '__main__': + unittest.main() -- cgit v1.3.1