Beispiel #1
0
 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())
Beispiel #2
0
 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())
Beispiel #3
0
 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())
Beispiel #4
0
 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())
Beispiel #5
0
 def test_set_columns(self):
     reader = DatabaseReader(self.db, "src")
     task = Task(reader, columns={"uuid"})
     self.assertEqual(task.dataset.get_all(), [{"uuid": 1}])
Beispiel #6
0
 def test_no_columns(self):
     reader = DatabaseReader(self.db, "src")
     task = Task(reader)
     self.assertEqual(task.dataset.get_all(), [self.src_record])
Beispiel #7
0
 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())