def test2(self): """ An exception must be thrown when a stored routine with designation type singleton1 returns 0 values. @expectedException Exception """ with self.assertRaises(Exception): DataLayer.tst_test_singleton1(0)
def test3(self): """ An exception must be thrown when a stored routine with designation type row0 returns more than 1 rows. @expectedException Exception """ with self.assertRaises(Exception): DataLayer.tst_test_row0(2)
def test2(self): """ Stored routine with designation type rows_with_index must return empty array when no rwos are selected. """ rows = DataLayer.tst_test_rows_with_index1(0) self.assertIsInstance(rows, dict) self.assertEqual(0, len(rows))
def test2(self): """ Stored routine with designation type rows must return an array with 1 row when only 1 row is selected. """ ret = DataLayer.tst_test_rows(1) self.assertIsInstance(ret, list) self.assertEqual(1, len(ret))
def test2(self): """ Stored routine with designation type rows_with_key must return empty array when no rows are selected. """ rows = DataLayer.tst_test_rows_with_key1(0) self.assertIsInstance(rows, dict) self.assertEqual(0, len(rows))
def test1(self): """ Stored routine with designation type rows must return an empty array when no rows are selected. """ ret = DataLayer.tst_test_rows(0) self.assertIsInstance(ret, list) self.assertEqual(0, len(ret))
def test3(self): """ Stored routine with designation type rows must return an array with 3 rows when 3 rows are selected. """ ret = DataLayer.tst_test_rows(3) self.assertIsInstance(ret, list) self.assertEqual(3, len(ret))
def test4(self): """ Test constant __DIR__. Must return name of the folder where the source file of routine the is located. """ dir_cur_file = os.path.dirname(os.path.abspath(__file__)) dir_name = os.path.realpath(dir_cur_file + '/psql') ret = DataLayer.tst_magic_constant04() self.assertEqual(dir_name, ret)
def test3(self): """ Test constant __FILE__. Must return the filename of the source of the routine. """ dir_cur_file = os.path.dirname(os.path.abspath(__file__)) path = os.path.realpath(dir_cur_file + "/psql/dbo.tst_magic_constant03.psql") filename = os.path.realpath(path) ret = DataLayer.tst_magic_constant03() self.assertEqual(filename, ret)
def test1(self): """ Stored routine with designation type rows_with_index must return multi dimensional array. """ rows = DataLayer.tst_test_rows_with_index1(100) self.assertIsInstance(rows, dict) self.assertIn('a', rows) self.assertIn('b', rows['a']) self.assertIsInstance(rows['a']['b'], list) self.assertEqual(3, len(rows['a']['b']))
def test1(self): """ Stored routine with designation type rows_with_key must return multi dimensional array. """ rows = DataLayer.tst_test_rows_with_key1(100) self.assertIsInstance(rows, dict) self.assertEqual(1, len(rows)) self.assertTrue('a' in rows) self.assertTrue('b' in rows['a']) self.assertNotEqual(0, len(rows['a']['b'])) self.assertTrue('c1' in rows['a']['b']) self.assertNotEqual(0, len(rows['a']['b']['c1']))
def test2(self): """ Stored routine with designation type row0 must return 1 row. """ ret = DataLayer.tst_test_row0(1) self.assertIsInstance(ret, dict)
def test1(self): """ Stored routine with designation type singleton1 must return 1 value and 1 value only. """ ret = DataLayer.tst_test_singleton1(1) self.assertEqual(1, ret)
def test2(self): """ Stored routine with designation type singleton0 must return 1 value. """ ret = DataLayer.tst_test_singleton0(1) self.assertIsInstance(ret, (str, int, float))
def test1(self): """ Test constant __ROUTINE__. Must return name of routine. """ ret = DataLayer.tst_magic_constant01() self.assertEqual('dbo.tst_magic_constant01', ret)
def test3(self): """ An exception must be thrown when a stored routine with designation type singleton0 returns more than 1 values. """ with self.assertRaises(Exception): DataLayer.tst_test_singleton0(3)
def tearDown(self): DataLayer.disconnect()
def setUp(self): DataLayer.connect('192.168.137.7', 'test', 'test', 'test')
def test2(self): """ Test constant __LINE__. Must return line number in the source code. """ ret = DataLayer.tst_magic_constant02() self.assertEqual(4, int(ret))
def test1(self): """ Stored routine with designation type function executes a stored function and return result. """ ret = DataLayer.tst_test_function(2, 3) self.assertEqual(5, ret)
def test1(self): """ Stored routine with designation type row1 must return 1 row and 1 row only. """ ret = DataLayer.tst_test_row1(1) self.assertIsInstance(ret, dict)
def test1(self): """ Stored routine with designation type row0 must return null. """ ret = DataLayer.tst_test_row0(0) self.assertIsNone(ret)