Esempio n. 1
0
 def setUpClass(cls):
     index_catalog(
         'test_catalog',
         os.path.join(samples_dir, 'distribution_daily_periodicity.json'),
         cls.index)
     enqueue_write_csv_task()
     super(DtaGeneratorTests, cls).setUpClass()
Esempio n. 2
0
 def setUpClass(cls):
     super(CSVTest, cls).setUpClass()
     cls.catalog_id = 'csv_dump_test_catalog'
     path = os.path.join(samples_dir, 'distribution_daily_periodicity.json')
     index_catalog(cls.catalog_id, path, cls.index)
     cls.task = GenerateDumpTask()
     cls.task.save()
     gen = DumpGenerator(cls.task)
     gen.generate()
Esempio n. 3
0
    def setUp(self):
        GenerateDumpTask.objects.all().delete()
        DumpFile.objects.all().delete()

        path = os.path.join(samples_dir, 'distribution_daily_periodicity.json')
        index_catalog('catalog_one', path, index=self.index)

        path = os.path.join(samples_dir, 'leading_nulls_distribution.json')
        index_catalog('catalog_two', path, index=self.index)
Esempio n. 4
0
    def setUpClass(cls):
        super(XLSXGeneratorTests, cls).setUpClass()
        GenerateDumpTask.objects.all().delete()
        DumpFile.objects.all().delete()

        path = os.path.join(samples_dir, 'distribution_daily_periodicity.json')
        index_catalog('catalog_one', path, index=cls.index)

        path = os.path.join(samples_dir, 'leading_nulls_distribution.json')
        index_catalog('catalog_two', path, index=cls.index)

        call_command('generate_dump')
Esempio n. 5
0
    def setUpClass(cls):
        super(SQLTests, cls).setUpClass()
        DumpFile.objects.all().delete()
        Node.objects.all().delete()
        Catalog.objects.all().delete()
        GenerateDumpTask.objects.all().delete()

        path = os.path.join(samples_dir, 'distribution_daily_periodicity.json')
        index_catalog('catalog_one', path, index=cls.index)

        call_command('generate_dump')
        task = GenerateDumpTask.objects.create()
        SQLGenerator(task.id).generate()
Esempio n. 6
0
    def test_leading_nulls_distribution(self):
        path = os.path.join(samples_dir, 'leading_nulls_distribution.json')
        index_catalog('leading_null', path, self.index)
        self.task = GenerateDumpTask()
        self.task.save()
        gen = DumpGenerator(self.task, 'leading_null')
        gen.generate()

        file = self.task.dumpfile_set.get(file_name=DumpFile.FILENAME_FULL,
                                          file_type=DumpFile.TYPE_CSV,
                                          node__catalog_id='leading_null').file
        reader = read_file_as_csv(file)

        next(reader)  # Header!!!!
        self.assertEqual(len(list(reader)), 1)  # Un único row, para un único valor del CSV
Esempio n. 7
0
    def setUpClass(cls):
        super(ViewTests, cls).setUpClass()
        es_client = ElasticInstance.get()
        if es_client.indices.exists(cls.index):
            es_client.indices.delete(cls.index)
        es_client.indices.create(cls.index, body=INDEX_CREATION_BODY)

        cls.catalog_id = 'csv_dump_test_catalog'
        path = os.path.join(samples_dir, 'distribution_daily_periodicity.json')
        index_catalog(cls.catalog_id, path, cls.index)
        cls.task = GenerateDumpTask()
        cls.task.save()
        gen = DumpGenerator(cls.task)
        gen.generate()

        DumpGenerator(cls.task, cls.catalog_id).generate()
Esempio n. 8
0
 def _index_catalog(self, catalog_path, node=None):
     path = os.path.join(SAMPLES_DIR, catalog_path)
     utils.index_catalog(CATALOG_ID, path, self.test_index, node=node)