def test_db_writer(self): writer = DatabaseWriter(self.db, "dst") writer.table.delete("1=1") writer.write(self.get_dataset(self.dst_record)) task = Task(DatabaseReader(self.db, "dst")) self.assertEqual(task.dataset.get_all(), self.get_dataset(self.dst_record).get_all())
def test_file_writer(self): file = self.get_file_path("dst.txt") writer = FileWriter(file) writer.write(self.get_dataset(self.dst_record)) task = Task(FileReader(file)) self.assertEqual(task.dataset.get_all(), self.get_dataset(self.dst_record).get_all())
def test_db_reader_by_con(self): con = self.db.driver.con writer = DatabaseWriter(con, "dst") writer.table.delete("1=1") writer.write(self.get_dataset(self.dst_record)) task = Task(DatabaseReader(self.db, "dst")) self.assertEqual(task.dataset.get_all(), self.get_dataset(self.dst_record).get_all())
def test_dict_columns(self): reader = DatabaseReader(self.db, "src") task = Task(reader, columns=self.columns) self.assertEqual(task.dataset.get_all(), self.get_dataset(self.dst_record).get_all())
def test_set_columns(self): reader = DatabaseReader(self.db, "src") task = Task(reader, columns={"uuid"}) self.assertEqual(task.dataset.get_all(), [{"uuid": 1}])
def test_no_columns(self): reader = DatabaseReader(self.db, "src") task = Task(reader) self.assertEqual(task.dataset.get_all(), [self.src_record])
def test_hive_writer(self): writer = HiveWriter(self.db, "dst") writer.write(self.get_dataset(self.dst_record)) task = Task(DatabaseReader(self.db, "dst")) self.assertEqual(task.dataset.get_all(), self.get_dataset(self.dst_record).get_all())