示例#1
0
 def tenant_spl(self):
     settings = openstack_tenant_factories.OpenStackTenantServiceSettingsFactory(
         customer=self.customer)
     service = openstack_tenant_factories.OpenStackTenantServiceFactory(
         customer=self.customer, settings=settings)
     return openstack_tenant_factories.OpenStackTenantServiceProjectLinkFactory(
         service=service, project=self.project)
示例#2
0
    def test_plan_is_imported(self):
        fixture = package_fixtures.PackageFixture()
        package = fixture.openstack_package
        template = fixture.openstack_template
        service_settings = package.service_settings

        service = openstack_tenant_factories.OpenStackTenantServiceFactory(settings=service_settings)
        spl = openstack_tenant_factories.OpenStackTenantServiceProjectLinkFactory(service=service)
        self.volume = openstack_tenant_factories.VolumeFactory(service_project_link=spl)

        utils.import_openstack_service_settings(fixture.customer)
        resource = self.import_resource()
        self.assertEqual(resource.plan.scope, template)
示例#3
0
 def test_rancher_cluster_is_filtered_out_for_unrelated_user(self):
     project = ProjectFactory(customer=self.fixture.customer)
     admin = UserFactory()
     project.add_user(admin, ProjectRole.ADMINISTRATOR)
     tenant_spl = openstack_tenant_factories.OpenStackTenantServiceProjectLinkFactory(
         service=self.fixture.tenant_spl.service, project=project)
     vm = openstack_tenant_factories.InstanceFactory(
         service_project_link=tenant_spl,
         state=StateMixin.States.OK,
     )
     self.client.force_authenticate(admin)
     response = self.client.get(
         openstack_tenant_factories.InstanceFactory.get_url(vm))
     self.assertEqual(response.status_code, status.HTTP_200_OK)
     self.assertEqual(response.data['rancher_cluster'], None)
示例#4
0
 def spl(self):
     return ot_factories.OpenStackTenantServiceProjectLinkFactory(
         project=self.project)