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()
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'})
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]
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'))
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)
def setUp(self): self.user = '******' self.passwd = 'admin' create_models(type='layer') create_layer_data() create_notifications() self.anonymous_user = get_anonymous_user()
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)
def setUp(self): self.user = '******' self.passwd = 'admin' create_models(type='map') create_models(type='layer') create_maplayers() create_notifications()
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()
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')
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' })
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()
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')
def setUp(self): super(CollectionTest, self).setUp() create_models(type='layer') create_collection_data() self.user = '******' self.passwd = 'admin'
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()
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":[]}
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()
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": {}}
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)
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()
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()
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()
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()
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)
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()
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()
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()
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()
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": {}}
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()
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()
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()
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": {}}
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 = """
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()
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')
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)
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()
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()
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;' )
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()
def setUp(self): self.user = "******" self.passwd = "admin" create_models(type="layer") create_layer_data()
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')
def setUp(self): self.user = '******' self.passwd = 'admin' create_models(type='layer') create_layer_data()
def setUp(self): super(GeoNodeBaseTestSupport, self).setUp() logging.info(" Test setUp. Creating models.") self.get_obj_ids = create_models(type=self.get_type)
def setUp(self): create_models(type='layer') create_layer_data() self.user = get_user_model().objects.filter(username='******')[0]