Beispiel #1
0
    def setUp(self):
        super().setUp()
        self.user = '******'
        self.passwd = 'admin'
        create_dataset_data()
        self.config = Configuration.load()

        self.OGC_DEFAULT_SETTINGS = {
            'default': {
                'BACKEND': 'geonode.geoserver',
                'LOCATION': 'http://localhost:8080/geoserver/',
                'USER': '******',
                'PASSWORD': '******',
                'MAPFISH_PRINT_ENABLED': True,
                'PRINT_NG_ENABLED': True,
                'GEONODE_SECURITY_ENABLED': True,
                'GEOFENCE_SECURITY_ENABLED': True,
                'WMST_ENABLED': False,
                'BACKEND_WRITE_ENABLED': True,
                'WPS_ENABLED': False,
                'DATASTORE': '',
            }
        }

        self.UPLOADER_DEFAULT_SETTINGS = {
            'BACKEND': 'geonode.importer',
            'OPTIONS': {
                'TIME_ENABLED': False,
                'MOSAIC_ENABLED': False}}

        self.DATABASE_DEFAULT_SETTINGS = {
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': 'development.db'}}
Beispiel #2
0
    def test_delete(self):
        doc = create_single_doc("test_delete_doc")
        dt = create_single_dataset("test_delete_dataset")
        map = create_single_map("test_delete_dataset")
        Service.objects.create(
            base_url="http://fake_test",
            owner=self.user)

        # Add dataset to a map
        MapLayer.objects.create(map=map, name=dt.alternate, stack_order=1).save()
        # Create the rating for dataset
        OverallRating.objects.create(
            category=2,
            object_id=dt.id,
            content_type=ContentType.objects.get(model='dataset'),
            rating=3)
        create_dataset_data(dt.resourcebase_ptr_id)
        res = self.rm.delete(doc.uuid, instance=doc)
        self.assertTrue(res)
        # Before dataset delete
        self.assertEqual(MapLayer.objects.filter(name='geonode:test_delete_dataset').count(), 1)
        self.assertEqual(OverallRating.objects.filter(object_id=dt.id).count(), 1)
        # try deleting with no default style, havest_job withalternate as resource_id, with uploads
        # TODO
        res = self.rm.delete(dt.uuid, instance=dt)
        self.assertTrue(res)

        # After dataset delete
        self.assertEqual(MapLayer.objects.filter(name='geonode:test_delete_dataset').count(), 0)
        self.assertEqual(OverallRating.objects.filter(object_id=dt.id).count(), 0)
Beispiel #3
0
    def setUp(self):
        super().setUp()

        registry.register(Dataset)
        registry.register(Comment)
        registry.register(get_user_model())
        create_dataset_data()
        self.user = get_user_model().objects.filter(username='******')[0]
Beispiel #4
0
    def test_set_attributes_from_geoserver(self):
        """Test attributes syncronization
        """
        layer = Dataset.objects.all().first()
        create_dataset_data(layer.resourcebase_ptr_id)
        try:
            # set attributes for resource
            for attribute in layer.attribute_set.all():
                attribute.attribute_label = f'{attribute.attribute}_label'
                attribute.description = f'{attribute.attribute}_description'
                attribute.save()

            # tests if everything is synced properly
            for attribute in layer.attribute_set.all():
                self.assertEqual(
                    attribute.attribute_label,
                    f'{attribute.attribute}_label'
                )
                self.assertEqual(
                    attribute.description,
                    f'{attribute.attribute}_description'
                )

            # sync the attributes with GeoServer
            # since on geoserver are empty, we expect that now the layer
            # does not have any attribute
            set_attributes_from_geoserver(layer)

            links = Link.objects.filter(resource=layer.resourcebase_ptr)
            self.assertIsNotNone(links)
            self.assertTrue(len(links) >= 7)

            original_data_links = [ll for ll in links if 'original' == ll.link_type]
            self.assertEqual(len(original_data_links), 0)

        finally:
            # Clean up and completely delete the layers
            layer.delete()
Beispiel #5
0
 def setUp(self):
     super().setUp()
     self.request = self.__request_factory_single(123)
     create_dataset_data()
     self.user = "******"
     self.passwd = "admin"
Beispiel #6
0
 def setUp(self):
     super().setUp()
     self.user = '******'
     self.passwd = 'admin'
     create_dataset_data()
Beispiel #7
0
 def setUp(self):
     super().setUp()
     create_dataset_data()