Exemplo n.º 1
0
 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)
Exemplo n.º 2
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)
Exemplo n.º 3
0
 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))
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 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))
Exemplo n.º 6
0
 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))
Exemplo n.º 7
0
 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))
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 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)
Exemplo n.º 11
0
 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)
Exemplo n.º 12
0
 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']))
Exemplo n.º 13
0
 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']))
Exemplo n.º 14
0
 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']))
Exemplo n.º 15
0
 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']))
Exemplo n.º 16
0
 def test2(self):
     """
     Stored routine with designation type row0 must return 1 row.
     """
     ret = DataLayer.tst_test_row0(1)
     self.assertIsInstance(ret, dict)
Exemplo n.º 17
0
 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)
Exemplo n.º 18
0
 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))
Exemplo n.º 19
0
 def test1(self):
     """
     Test constant __ROUTINE__. Must return name of routine.
     """
     ret = DataLayer.tst_magic_constant01()
     self.assertEqual('dbo.tst_magic_constant01', ret)
Exemplo n.º 20
0
 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)
Exemplo n.º 21
0
 def tearDown(self):
     DataLayer.disconnect()
Exemplo n.º 22
0
 def setUp(self):
     DataLayer.connect('192.168.137.7', 'test', 'test', 'test')
Exemplo n.º 23
0
 def test1(self):
     """
     Test constant __ROUTINE__. Must return name of routine.
     """
     ret = DataLayer.tst_magic_constant01()
     self.assertEqual('dbo.tst_magic_constant01', ret)
Exemplo n.º 24
0
 def test2(self):
     """
     Test constant __LINE__. Must return line number in the source code.
     """
     ret = DataLayer.tst_magic_constant02()
     self.assertEqual(4, int(ret))
Exemplo n.º 25
0
 def setUp(self):
     DataLayer.connect('192.168.137.7', 'test', 'test', 'test')
Exemplo n.º 26
0
 def tearDown(self):
     DataLayer.disconnect()
Exemplo n.º 27
0
 def test2(self):
     """
     Test constant __LINE__. Must return line number in the source code.
     """
     ret = DataLayer.tst_magic_constant02()
     self.assertEqual(4, int(ret))
Exemplo n.º 28
0
 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)
Exemplo n.º 29
0
 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)
Exemplo n.º 30
0
 def test1(self):
     """
     Stored routine with designation type row0 must return null.
     """
     ret = DataLayer.tst_test_row0(0)
     self.assertIsNone(ret)
Exemplo n.º 31
0
 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)