Пример #1
0
 def test_catalog_is_not_present_on_connection_failure(self):
     index_catalog(self.node, self.task, read_local=True, whitelist=True)
     self.node.catalog_url = 'invalid_url'
     index_catalog(self.node, self.task, read_local=False, whitelist=True)
     catalog_model = Catalog.objects.get(identifier=self.catalog_id)
     self.assertTrue(catalog_model.error)
     self.assertFalse(catalog_model.present)
Пример #2
0
 def setUp(self):
     self.catalog_id = "one"
     node = Node.objects.create(catalog_url=os.path.join(SAMPLES_DIR, 'single_distribution.json'),
                                catalog_id=self.catalog_id,
                                indexable=True)
     index_catalog(node, ReadDataJsonTask.objects.create(), whitelist=True)
     user = User.objects.create(username='******', password='******', is_staff=True, is_superuser=True)
     self.client.force_login(user)
Пример #3
0
    def test_index_same_series_different_catalogs(self):
        index_catalog(self.node, self.task, read_local=True, whitelist=True)
        index_catalog(self.node, self.task, read_local=True, whitelist=True)

        count = Field.objects.filter(
            metadata__contains='212.1_PSCIOS_ERN_0_0_25').count()

        self.assertEqual(count, 1)
Пример #4
0
    def test_error_distribution_logs(self):
        catalog = os.path.join(SAMPLES_DIR,
                               'distribution_missing_downloadurl.json')
        self.node.catalog_url = catalog
        self.node.save()
        index_catalog(self.node, self.task, read_local=True, whitelist=True)

        self.assertGreater(
            len(ReadDataJsonTask.objects.get(id=self.task.id).logs), 10)
Пример #5
0
    def setUpTestData(cls):
        cls.task = ReadDataJsonTask.objects.create(
            indexing_mode=ReadDataJsonTask.METADATA_ONLY)
        cls.node = Node(catalog_id=cls.catalog_id, catalog_url=cls.catalog,
                        indexable=True)
        cls.node.save()
        index_catalog(cls.node, cls.task, read_local=True, whitelist=True)

        cls.node_two = create_node(cls.catalog_two, cls.catalog_two_id)
        index_catalog(cls.node_two, cls.task, read_local=True, whitelist=True)
Пример #6
0
 def test_node_with_automatic_indexation_enabled_indexes_new_datasets(self):
     auto_index_node = Node(catalog_id='text_id',
                            catalog_url=self.catalog,
                            indexable=True,
                            new_datasets_auto_indexable=True)
     auto_index_node.save()
     index_catalog(auto_index_node, self.task)
     dataset = Catalog.objects.get(
         identifier=auto_index_node.catalog_id).dataset_set.first()
     self.assertTrue(dataset.indexable)
Пример #7
0
    def test_index_only_time_series_if_specified(self):
        settings.DATAJSON_AR_TIME_SERIES_ONLY = True
        mixed_catalog = os.path.join(SAMPLES_DIR,
                                     'mixed_time_series_catalog.json')
        self.node.catalog_url = mixed_catalog
        self.node.save()
        index_catalog(self.node, self.task, read_local=True, whitelist=True)
        settings.DATAJSON_AR_TIME_SERIES_ONLY = False

        self.assertEqual(Distribution.objects.count(), 2)
        # La distribution ID 5.1 que no es serie de tiempo no fue creada
        self.assertFalse(Distribution.objects.filter(identifier__in=["5.1"]))
Пример #8
0
 def test_whitelisted_node_automatically_indexes_new_datasets(self):
     index_catalog(self.node, self.task, whitelist=True)
     dataset = Catalog.objects.get(
         identifier=self.catalog_id).dataset_set.first()
     self.assertTrue(dataset.indexable)
Пример #9
0
 def test_node_does_not_automatically_index_new_datasets_by_default(self):
     index_catalog(self.node, self.task)
     dataset = Catalog.objects.get(
         identifier=self.catalog_id).dataset_set.first()
     self.assertFalse(dataset.indexable)
Пример #10
0
 def test_catalog_is_present_on_connection_success(self):
     index_catalog(self.node, self.task, read_local=True, whitelist=True)
     catalog_model = Catalog.objects.get(identifier=self.catalog_id)
     self.assertFalse(catalog_model.error)
     self.assertTrue(catalog_model.present)