diff options
| -rw-r--r-- | dbutils.py | 5 | ||||
| -rw-r--r-- | dbutils_test.py | 15 |
2 files changed, 18 insertions, 2 deletions
@@ -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() |
