def setUp(self): self.user = create_superadminuser() self.group = self.user.groups.first() self.metadata = create_wms_service(self.group, how_much_services=10)[0] # Declare timeout span self.timeout_delta = timezone.timedelta(seconds=10) # For new service testing create_non_autogenerated_orgas(self.user, 3) self.org = Organization.objects.all().first() # For securing service create_operation(OGCOperationEnum.GET_MAP.value) self.operation = RequestOperation.objects.all().first()
def setUp(self): # creates user object in db self.user_password = PASSWORD self.groups = create_guest_groups(how_much_groups=9) self.user = create_superadminuser(groups=self.groups) self.orgas = create_non_autogenerated_orgas(user=self.user, how_much_orgas=10) # Set individual organization for each group i = 0 for group in self.groups: group.organization = self.orgas[i] group.save() i = i + 1 # Public group needs an organization for this test public_orga = create_public_organization(user=self.user, )[0] public_group = MrMapGroup.objects.get(is_public_group=True) public_group.organization = public_orga public_group.save() self.user.organization = self.orgas[0] self.user.save() self.user.refresh_from_db() self.request_factory = RequestFactory() # Create an instance of a GET request. self.request = self.request_factory.get('/') # Recall that middleware are not supported. You can simulate a # logged-in user by setting request.user manually. self.request.user = self.user self.groups_url_path_name = STRUCTURE_INDEX_GROUP self.orgs_url_path_name = STRUCTURE_INDEX_ORGANIZATION
def setUp(self): # creates user object in db self.user_password = PASSWORD self.groups = create_guest_groups(how_much_groups=9) self.user = create_testuser(groups=self.groups) for group in self.groups: group.created_by = self.user group.save() self.orgas = create_non_autogenerated_orgas(user=self.user, how_much_orgas=10) self.user.organization = self.orgas[0] self.user.save() self.user.refresh_from_db() self.pending_request = create_publish_request( group=self.groups[0], orga=self.user.organization, ) self.pending_tasks = create_pending_task(group=self.groups[0], how_much_pending_tasks=10) self.client = Client() self.client.login(username=self.user.username, password=self.user_password)
def setUp(self): # creates user object in db self.user_password = PASSWORD self.groups = create_guest_groups(how_much_groups=9) self.user = create_testuser(groups=self.groups) self.orgas = create_non_autogenerated_orgas(user=self.user, how_much_orgas=10) self.user.organization = self.orgas[0] self.user.organization.save() self.client = Client() self.client.login(username=self.user.username, password=self.user_password)
def test_removing_of_updatecandidates(self): older_than = 10 user = create_superadminuser() organizations = create_non_autogenerated_orgas(user=user) wms_metadatas = create_wms_service(group=user.groups.first(), contact=organizations[0], how_much_services=10) wfs_metadatas = create_wfs_service(group=user.groups.first(), contact=organizations[0], how_much_services=10) for wms_metadata in wms_metadatas: update_candidate_metadata = create_wms_service( group=user.groups.first(), contact=organizations[0], how_much_services=1, is_update_candidate_for=wms_metadata.service, user=user) update_candidate_metadata[ 0].service.last_modified = timezone.localtime( ) - timezone.timedelta(days=older_than, ) update_candidate_metadata[0].service.save( update_last_modified=False) for wfs_metadata in wfs_metadatas: update_candidate_metadata = create_wfs_service( group=user.groups.first(), contact=organizations[0], how_much_services=1, is_update_candidate_for=wfs_metadata.service, user=user) update_candidate_metadata[ 0].service.last_modified = timezone.localtime( ) - timezone.timedelta(days=older_than) update_candidate_metadata[0].service.save( update_last_modified=False) out = StringIO() call_command('rm_updatecandidates', stdout=out, ot=older_than) self.assertIn( 'Deleted 20 objects older than {} days'.format(older_than), out.getvalue()) services_count = Service.objects.filter(is_root=True).count() self.assertEqual(services_count, 20)
def setUp(self): self.default_user = create_testuser() self.user = create_superadminuser() self.user.organization = create_non_autogenerated_orgas(user=self.user, how_much_orgas=1)[0] self.user.save() self.client = Client() self.client.login(username=self.user.username, password=PASSWORD) self.request_factory = RequestFactory() self.wms_services = create_wms_service( group=self.user.groups.first(), how_much_services=1 ) # Setup for log proxy test self.metadata = Metadata.objects.all().first() self.metadata.use_proxy_uri = True self.metadata.log_proxy_access = True self.metadata.save() self.metadata.refresh_from_db()
def setUp(self): # creates user object in db self.user_password = PASSWORD self.groups = create_guest_groups(how_much_groups=9) self.user = create_testuser(groups=self.groups) for group in self.groups: group.created_by = self.user group.save() self.orgas = create_non_autogenerated_orgas(user=self.user, how_much_orgas=10) self.user.organization = self.orgas[0] self.user.save() self.user.refresh_from_db() self.user.groups.all()[0].publish_for_organizations.add( self.user.organization) self.client = Client() self.client.login(username=self.user.username, password=self.user_password)