예제 #1
0
 def setUp(self):
     super(DocumentsTest, self).setUp()
     create_models('map')
     self.imgfile = StringIO.StringIO(
         'GIF87a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00ccc,\x00'
         '\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
     self.anonymous_user = get_anonymous_user()
예제 #2
0
파일: tests.py 프로젝트: lhcramer/geonode
    def setUp(self):
        super(SearchApiTests, self).setUp()

        self.list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'layers'})
        create_models(type='layer')
        all_public()
        self.norman = get_user_model().objects.get(username="******")
        self.norman.groups.add(Group.objects.get(name='anonymous'))
        self.test_user = get_user_model().objects.get(username='******')
        self.test_user.groups.add(Group.objects.get(name='anonymous'))
        self.bar = GroupProfile.objects.get(slug='bar')
        self.anonymous_user = get_anonymous_user()
        self.profiles_list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'profiles'})
        self.groups_list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'groups'})
예제 #3
0
 def setUp(self):
     registry.register(Layer)
     registry.register(Comment)
     registry.register(Profile)
     create_models(type='layer')
     create_layer_data()
     self.user = get_user_model().objects.filter(username='******')[0]
예제 #4
0
    def setUp(self):
        super(SiteTests, self).setUp()
        create_sites()
        create_models(type='layer')

        self.user = '******'
        self.passwd = 'admin'
        self.admin = Profile.objects.get(username='******')
        self.bobby = Profile.objects.get(username='******')
        self.master_site = Site.objects.get(name='Master')
        self.slave_site = Site.objects.get(name='Slave')
        self.api_site_url = reverse('api_dispatch_list',
                                    kwargs={
                                        'api_name': 'api',
                                        'resource_name': 'sites'})
        self.api_slave_detail_url = reverse('api_dispatch_detail',
                                            kwargs={
                                                'api_name': 'api',
                                                'resource_name': 'sites',
                                                'pk': self.slave_site.pk})
        self.api_layer_url = reverse('api_dispatch_list',
                                     kwargs={
                                        'api_name': 'api',
                                        'resource_name': 'layers'})

        self.anonymous_user = get_anonymous_user()
        self.slave2_data = {'name': 'Slave2',
                            'domain': 'slave2.test.org'}
        # all layers belong to slave but let's remove one resource from it (CA)
        SiteResources.objects.get(site=self.slave_site).resources.remove(Layer.objects.get(typename='geonode:CA'))
예제 #5
0
파일: tests.py 프로젝트: CNR-ISMAR/adriplan
    def test_map_download(self):
        """Test the correct permissions on layers on map download"""
        create_models(type='map')
        create_maplayers()
        # Get a Map
        the_map = Map.objects.get(title='GeoNode Default Map')

        # Get a MapLayer and set the parameters as it is local and not a background
        # and leave it alone in the map
        map_layer = the_map.layer_set.get(name='geonode:CA')
        map_layer.local = True
        map_layer.group = 'overlay'
        map_layer.save()
        the_map.layer_set.all().delete()
        the_map.layer_set.add(map_layer)

        # Get the Layer and set the permissions for bobby to it and the map
        bobby = Profile.objects.get(username='******')
        the_layer = Layer.objects.get(typename='geonode:CA')
        remove_perm('download_resourcebase', bobby, the_layer.get_self_resource())
        remove_perm('download_resourcebase', Group.objects.get(name='anonymous'),
                    the_layer.get_self_resource())
        assign_perm('view_resourcebase', bobby, the_layer.get_self_resource())
        assign_perm('download_resourcebase', bobby, the_map.get_self_resource())

        self.client.login(username='******', password='******')

        response = self.client.get(reverse('map_download', args=(the_map.id,)))
        self.assertTrue('Could not find downloadable layers for this map' in response.content)
예제 #6
0
파일: tests.py 프로젝트: alaw005/geonode
 def setUp(self):
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='layer')
     create_layer_data()
     create_notifications()
     self.anonymous_user = get_anonymous_user()
예제 #7
0
    def test_map_download(self):
        """Test the correct permissions on layers on map download"""
        create_models(type='map')
        create_maplayers()
        # Get a Map
        the_map = Map.objects.get(title='GeoNode Default Map')

        # Get a MapLayer and set the parameters as it is local and not a background
        # and leave it alone in the map
        map_layer = the_map.layer_set.get(name='geonode:CA')
        map_layer.local = True
        map_layer.group = 'overlay'
        map_layer.save()
        the_map.layer_set.all().delete()
        the_map.layer_set.add(map_layer)

        # Get the Layer and set the permissions for bobby to it and the map
        bobby = Profile.objects.get(username='******')
        the_layer = Layer.objects.get(alternate='geonode:CA')
        remove_perm('download_resourcebase', bobby, the_layer.get_self_resource())
        remove_perm('download_resourcebase', Group.objects.get(name='anonymous'),
                    the_layer.get_self_resource())
        assign_perm('view_resourcebase', bobby, the_layer.get_self_resource())
        assign_perm('download_resourcebase', bobby, the_map.get_self_resource())

        self.client.login(username='******', password='******')

        response = self.client.get(reverse('map_download', args=(the_map.id,)))
        self.assertTrue('Could not find downloadable layers for this map' in response.content)
예제 #8
0
파일: tests.py 프로젝트: alaw005/geonode
 def setUp(self):
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='map')
     create_models(type='layer')
     create_maplayers()
     create_notifications()
예제 #9
0
 def setUp(self):
     super().setUp()
     create_models('map')
     self.imgfile = io.BytesIO(
         b'GIF87a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00ccc,\x00'
         b'\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
     self.anonymous_user = get_anonymous_user()
예제 #10
0
    def setUp(self):
        # these are needed for the geonode fixtures
        TopicCategory.objects.create(identifier='biota')
        TopicCategory.objects.create(identifier='location')
        TopicCategory.objects.create(identifier='elevation')

        create_models(type='map')
예제 #11
0
    def setUp(self):
        super(SearchApiTests, self).setUp()

        self.list_url = reverse('api_dispatch_list',
                                kwargs={
                                    'api_name': 'api',
                                    'resource_name': 'layers'
                                })
        create_models(type='layer')
        all_public()
        self.norman = get_user_model().objects.get(username="******")
        self.norman.groups.add(Group.objects.get(name='anonymous'))
        self.test_user = get_user_model().objects.get(username='******')
        self.test_user.groups.add(Group.objects.get(name='anonymous'))
        self.bar = GroupProfile.objects.get(slug='bar')
        self.anonymous_user = get_anonymous_user()
        self.profiles_list_url = reverse('api_dispatch_list',
                                         kwargs={
                                             'api_name': 'api',
                                             'resource_name': 'profiles'
                                         })
        self.groups_list_url = reverse('api_dispatch_list',
                                       kwargs={
                                           'api_name': 'api',
                                           'resource_name': 'groups'
                                       })
예제 #12
0
    def setUp(self):
        # these are needed for the geonode fixtures
        TopicCategory.objects.create(identifier='biota')
        TopicCategory.objects.create(identifier='location')
        TopicCategory.objects.create(identifier='elevation')

        create_models(type='map')
예제 #13
0
 def setUp(self):
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='layer')
     create_layer_data()
     create_notifications()
     self.anonymous_user = get_anonymous_user()
예제 #14
0
 def setUp(self):
     super(OWSApiTestCase, self).setUp()
     create_models(type='layer')
     # prepare some WMS endpoints
     q = Link.objects.all()
     for l in q[:3]:
         l.link_type = 'OGC:WMS'
         l.save()
예제 #15
0
파일: tests.py 프로젝트: MrLeion/geonode
 def setUp(self):
     super(OWSApiTestCase, self).setUp()
     create_models(type='layer')
     # prepare some WMS endpoints
     q = Link.objects.all()
     for l in q[:3]:
         l.link_type = 'OGC:WMS'
         l.save()
예제 #16
0
    def setUpClass(cls):
        super().setUpClass()
        create_models(type=cls.get_type, integration=cls.get_integration)
        all_public()
        cls.user_admin = get_user_model().objects.get(username="******")

        if check_ogc_backend(geoserver.BACKEND_PACKAGE):
            cls.dataset_coast_line = create_single_dataset('san_andres_y_providencia_coastline')
예제 #17
0
    def setUp(self):

        super(CollectionTest, self).setUp()

        create_models(type='layer')
        create_collection_data()
        self.user = '******'
        self.passwd = 'admin'
예제 #18
0
 def setUp(self):
     super().setUp()
     create_models(type='layer')
     # prepare some WMS endpoints
     q = Link.objects.all()
     for lyr in q[:3]:
         lyr.link_type = 'OGC:WMS'
         lyr.save()
예제 #19
0
파일: tests.py 프로젝트: jsiochi/geonode
    def setUp(self):
        super(PermissionsApiTests, self).setUp()

        self.user = '******'
        self.passwd = 'admin'
        self.list_url = reverse('api_dispatch_list', kwargs={'api_name':'api', 'resource_name':'layers'})
        create_models(type='layer')
        all_public()
        self.perm_spec = {"anonymous":"_none","authenticated":"layer_readwrite","users":[]}
예제 #20
0
파일: tests.py 프로젝트: pasing/geonode
 def setUp(self):
     super().setUp()
     self.maxDiff = None
     create_models(type='dataset')
     # prepare some WMS endpoints
     q = Link.objects.all()
     for lyr in q[:3]:
         lyr.link_type = 'OGC:WMS'
         lyr.save()
예제 #21
0
    def setUp(self):
        super(PermissionsApiTests, self).setUp()

        self.user = '******'
        self.passwd = 'admin'
        self.list_url = reverse('api_dispatch_list', kwargs={'api_name':'api', 'resource_name':'layers'})
        create_models(type='layer')
        all_public()
        self.perm_spec = {"users": {}, "groups": {}}
예제 #22
0
 def setUp(self):
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='document')
     self.anonymous_user = get_anonymous_user()
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
     self.setup_notifications_for(DocumentsAppConfig.NOTIFICATIONS, self.u)
예제 #23
0
 def setUp(self):
     super(DocumentModerationTestCase, self).setUp()
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='document')
     create_models(type='map')
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
예제 #24
0
    def setUp(self):
        super(SearchApiTests, self).setUp()

        self.list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'layers'})
        create_models(type='layer')
        all_public()
예제 #25
0
    def setUp(self):
        super(SearchApiTests, self).setUp()

        self.list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'layers'})
        create_models(type='layer')
        all_public()
예제 #26
0
 def setUp(self):
     super(FavoriteTest, self).setUp()
     self.adm_un = "admin"
     self.adm_pw = "admin"
     create_models(type="document")
     self.list_url = reverse(
         'api_dispatch_list',
         kwargs={
             'api_name': 'api',
             'resource_name': 'favorites'})
     self.api_client = TestApiClient()
예제 #27
0
 def setUp(self):
     super(FavoriteTest, self).setUp()
     self.adm_un = "admin"
     self.adm_pw = "admin"
     create_models(type="document")
     self.list_url = reverse('api_dispatch_list',
                             kwargs={
                                 'api_name': 'api',
                                 'resource_name': 'favorites'
                             })
     self.api_client = TestApiClient()
예제 #28
0
 def setUp(self):
     super(MapsNotificationsTestCase, self).setUp()
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='layer')
     create_models(type='map')
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
     self.setup_notifications_for(MapsAppConfig.NOTIFICATIONS, self.u)
예제 #29
0
파일: tests.py 프로젝트: akarmas/geonode
 def setUp(self):
     super(MapsNotificationsTestCase, self).setUp()
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='layer')
     create_models(type='map')
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
     self.setup_notifications_for(MapsAppConfig.NOTIFICATIONS, self.u)
예제 #30
0
파일: tests.py 프로젝트: safezpa/geonode
 def setUp(self):
     super(LayerModerationTestCase, self).setUp()
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='layer')
     create_layer_data()
     self.anonymous_user = get_anonymous_user()
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
예제 #31
0
 def setUp(self):
     super(DocumentModerationTestCase, self).setUp()
     self.user = '******'
     self.passwd = 'admin'
     create_models(type=b'document')
     create_models(type=b'map')
     self.document_upload_url = f"{(reverse('document_upload'))}?no__redirect=true"
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
예제 #32
0
 def setUp(self):
     super().setUp()
     self.user = '******'
     self.passwd = 'admin'
     create_models(type=b'document')
     create_models(type=b'map')
     self.project_root = os.path.abspath(os.path.dirname(__file__))
     self.document_upload_url = f"{(reverse('document_upload'))}?no__redirect=true"
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
예제 #33
0
    def setUp(self):
        super(TrainingApiTest, self).setUp()

        self.username = '******'
        self.password = '******'
        self.list_url = reverse('api_dispatch_list',
                                kwargs={
                                    'api_name': 'api',
                                    'resource_name': 'trainings'
                                })
        create_models('layer')
        for i in range(0, 10):
            training_factory()
예제 #34
0
    def setUp(self):
        super(PermissionsApiTests, self).setUp()

        self.user = '******'
        self.passwd = 'admin'
        self.list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'layers'})
        create_models(type='layer')
        all_public()
        self.perm_spec = {"users": {}, "groups": {}}
예제 #35
0
    def setUp(self):
        self.user = '******'
        self.passwd = 'admin'
        create_models(type='layer')
        create_layer_data()
        create_notifications()
        self.anonymous_user = get_anonymous_user()

        self.list_url = reverse('api_dispatch_list',
                                kwargs={
                                    'api_name': 'api',
                                    'resource_name': 'layers'
                                })
        all_public()
예제 #36
0
파일: tests.py 프로젝트: alaw005/geonode
    def setUp(self):
        self.user = '******'
        self.passwd = 'admin'
        create_models(type='layer')
        create_layer_data()
        create_notifications()
        self.anonymous_user = get_anonymous_user()

        self.list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'layers'})
        all_public()
예제 #37
0
 def setUp(self):
     super(DocumentModerationTestCase, self).setUp()
     thumbs_dir = os.path.join(settings.MEDIA_ROOT, "thumbs")
     if not os.path.exists(thumbs_dir):
         os.mkdir(thumbs_dir)
     self.user = '******'
     self.passwd = 'admin'
     create_models(type=b'document')
     create_models(type=b'map')
     self.document_upload_url = "{}?no__redirect=true".format(
         reverse('document_upload'))
     self.u = get_user_model().objects.get(username=self.user)
     self.u.email = '*****@*****.**'
     self.u.is_active = True
     self.u.save()
예제 #38
0
    def setUp(self):
        super(BulkPermissionsTests, self).setUp()

        self.user = '******'
        self.passwd = 'admin'
        self.list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'layers'})
        self.bulk_perms_url = reverse('bulk_permissions')
        create_models(type='layer')
        all_public()
        self.perm_spec = {
            "users": {"admin": ["view_resourcebase"]}, "groups": {}}
예제 #39
0
파일: tests.py 프로젝트: CNR-ISMAR/adriplan
    def setUp(self):
        super(BulkPermissionsTests, self).setUp()

        self.user = '******'
        self.passwd = 'admin'
        self.list_url = reverse(
            'api_dispatch_list',
            kwargs={
                'api_name': 'api',
                'resource_name': 'layers'})
        self.bulk_perms_url = reverse('bulk_permissions')
        create_models(type='layer')
        all_public()
        self.perm_spec = {
            "users": {"admin": ["view_resourcebase"]}, "groups": {}}
예제 #40
0
파일: tests.py 프로젝트: cuulee/analytics
    def setUp(self):
        self.client = Client()
        self.user = '******'
        self.passwd = 'admin'

        create_models()
        self.fixtures = populate_db()

        self.analysis_json = """
        {
            "title": "Test title",
            "abstract": "Test abstract",
            "data": { "someData": "test data" }
        }
        """
        self.analysis_missing_element_json = """
예제 #41
0
    def setUp(self):
        super(DataScopeTestCase, self).setUp()
        from decat_geonode.models import populate_tests as populate

        create_models(type='layer')

        uname, upasswd = 'admin', 'admin'
        umodel = get_user_model()
        self.user, _ = umodel.objects.get_or_create(username=uname)
        self.user.email = '[email protected]'
        self.user.is_active = True
        self.user.is_superuser = True
        self.user.set_password(upasswd)
        self.upassword = upasswd
        self.username = uname
        self.user.save()
        populate()
예제 #42
0
    def setUp(self):

        try:
            # Ensure that gs_catalog.about() is falsy
            assert not gs_catalog.about()
        except AssertionError:
            # geoserver is running, skip the test
            self.skipTest('Geoserver should not be running for this test.')
        except socket_error as e:
            # gs_config.about() will throw a socket error if geoserver is not running (which is good in this case)
            pass

        TopicCategory.objects.create(identifier='biota')
        TopicCategory.objects.create(identifier='location')
        TopicCategory.objects.create(identifier='elevation')

        create_models(type='layer')
예제 #43
0
    def setUp(self):

        try:
            # Ensure that gs_catalog.about() is falsy
            assert not gs_catalog.about()
        except AssertionError:
            # geoserver is running, skip the test
            self.skipTest('Geoserver should not be running for this test.')
        except socket_error as e:
            # gs_config.about() will throw a socket error if geoserver is not running (which is good in this case)
            pass

        TopicCategory.objects.create(identifier='biota')
        TopicCategory.objects.create(identifier='location')
        TopicCategory.objects.create(identifier='elevation')

        create_models(type='layer')
예제 #44
0
    def setUp(self):
        create_models('layer')
        self.user = '******'
        self.passwd = 'admin'
        self.u, _ = get_user_model().objects.get_or_create(username=self.user)
        self.u.is_active = True
        self.u.email = '*****@*****.**'
        self.u.set_password(self.passwd)
        self.u.save()
        self.ua = ("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36"
                   "(KHTML, like Gecko) Chrome/59.0.3071.47 Safari/537.36")
        populate()

        self.host = Host.objects.create(name='localhost', ip='127.0.0.1')
        self.service_type = ServiceType.objects.get(name=ServiceType.TYPE_GEONODE)
        self.service = Service.objects.create(name=settings.MONITORING_SERVICE_NAME,
                                              host=self.host,
                                              service_type=self.service_type)
예제 #45
0
 def setUp(self):
     create_models(type='layer')
     create_models(type='map')
     create_models(type='document')
     self.norman = get_user_model().objects.get(username="******")
     self.bar = GroupProfile.objects.get(slug='bar')
     self.anonymous_user = get_anonymous_user()
예제 #46
0
파일: tests.py 프로젝트: EOSIT/geonode
 def setUp(self):
     from django.contrib.auth.models import Group
     create_models(type='layer')
     create_models(type='map')
     create_models(type='document')
     self.norman = get_user_model().objects.get(username="******")
     self.norman.groups.add(Group.objects.get(name='anonymous'))
     self.bar = GroupProfile.objects.get(slug='bar')
     self.anonymous_user = get_anonymous_user()
예제 #47
0
    def setUp(self):
        create_models('document')
        create_models('map')
        create_models('layer')

        self.test_file = StringIO.StringIO(
            'GIF87a\x01\x00\x01\x00\x80\x01\x00\x00\x00\x00ccc,\x00'
            '\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;'
        )
예제 #48
0
파일: tests.py 프로젝트: artists974/geonode
 def setUp(self):
     create_models(type="layer")
     create_models(type="map")
     create_models(type="document")
     self.norman = get_user_model().objects.get(username="******")
     self.norman.groups.add(Group.objects.get(name="anonymous"))
     self.test_user = get_user_model().objects.get(username="******")
     self.test_user.groups.add(Group.objects.get(name="anonymous"))
     self.bar = GroupProfile.objects.get(slug="bar")
     self.anonymous_user = get_anonymous_user()
예제 #49
0
파일: tests.py 프로젝트: kamalhg/geonode
 def setUp(self):
     self.user = "******"
     self.passwd = "admin"
     create_models(type="layer")
     create_layer_data()
예제 #50
0
 def setUp(self):
     create_models(type='layer')
     create_models(type='map')
     create_models(type='document')
     self.norman = User.objects.get(username="******")
     self.bar = Group.objects.get(slug='bar')
예제 #51
0
 def setUp(self):
     self.user = '******'
     self.passwd = 'admin'
     create_models(type='layer')
     create_layer_data()
예제 #52
0
 def setUp(self):
     super(GeoNodeBaseTestSupport, self).setUp()
     logging.info(" Test setUp. Creating models.")
     self.get_obj_ids = create_models(type=self.get_type)
예제 #53
0
 def setUp(self):
     create_models(type='layer')
     create_layer_data()
     self.user = get_user_model().objects.filter(username='******')[0]