Esempio n. 1
0
 def test_copy_to_predefined_table(self):
     task = self.create_task(cls=CopyToPredefinedVerticaDummyTable)
     cursor = MagicMock()
     task.copy_data_table_from_target(cursor)
     query = cursor.copy.call_args[0][0]
     self.assertEquals(query, self._get_expected_query())
     file_to_copy = cursor.copy.call_args[0][1]
     with task.input()['insert_source'].open('r') as expected_data:
         expected_source = expected_data.read()
     sent_source = file_to_copy.read()
     self.assertEquals(sent_source, expected_source)
Esempio n. 2
0
 def test_copy_multiple_rows(self):
     task = self.create_task(source=self._get_source_string(4))
     cursor = MagicMock()
     task.copy_data_table_from_target(cursor)
     query = cursor.copy.call_args[0][0]
     self.assertEquals(query, self._get_expected_query())
     file_to_copy = cursor.copy.call_args[0][1]
     with task.input()['insert_source'].open('r') as expected_data:
         expected_source = expected_data.read()
     sent_source = file_to_copy.read()
     self.assertEquals(sent_source, expected_source)