def setUp(self): super(QuotaUpdateTest, self).setUp() self.fixture = structure_fixtures.ServiceFixture() self.quota_name = structure_models.Customer.Quotas.nc_project_count self.quota = self.fixture.customer.quotas.get(name=self.quota_name) self.quota.usage = 10 self.quota.save() self.url = factories.QuotaFactory.get_url(self.quota)
def test_project_without_resources_is_deleted(self, get_extensions): fixture = fixtures.ServiceFixture() project = fixture.project get_extensions.return_value = [] executors.ProjectCleanupExecutor.execute(fixture.project, async=False) self.assertFalse(models.Project.objects.filter(id=project.id).exists())
def setUp(self): self.fixture = fixtures.ServiceFixture() self.project = self.fixture.project self.associated_certification = factories.ServiceCertificationFactory() self.project.certifications.add(self.associated_certification) self.new_certification = factories.ServiceCertificationFactory() self.url = factories.ProjectFactory.get_url( self.project, action='update_certifications')
def setUp(self): self.fixture = fixtures.ServiceFixture() self.owner = self.fixture.owner self.customer_support = self.fixture.customer_support self.admin = self.fixture.admin self.manager = self.fixture.manager self.project_support = self.fixture.project_support self.customer = self.fixture.customer self.service = self.fixture.service self.url = factories.CustomerFactory.get_url(self.customer, action='counters')
def setUp(self): self.fixture = fixtures.ServiceFixture() self.owner = self.fixture.owner self.admin = self.fixture.admin self.manager = self.fixture.manager self.project = self.fixture.project self.service = self.fixture.service self.resource = self.fixture.resource self.url = factories.ProjectFactory.get_url(self.project, action='counters')
def test_owner_cannot_unlink_service_with_shared_settings(self): fixture = fixtures.ServiceFixture() service_settings = factories.ServiceSettingsFactory(shared=True) service = test_models.TestService.objects.get(customer=fixture.customer, settings=service_settings) unlink_url = factories.TestServiceFactory.get_url(service, 'unlink') self.client.force_authenticate(fixture.owner) response = self.client.post(unlink_url) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) self.assertTrue(test_models.TestService.objects.filter(pk=service.pk).exists())
def test_project_with_resources_without_executors_is_not_deleted( self, get_extensions): fixture = fixtures.ServiceFixture() project = fixture.project resource = fixture.resource get_extensions.return_value = [] executors.ProjectCleanupExecutor.execute(fixture.project, async=False) self.assertTrue(models.Project.objects.filter(id=project.id).exists()) self.assertTrue( test_models.TestNewInstance.objects.filter( id=resource.id).exists())
def test_project_with_resources_and_executors_is_deleted( self, get_extensions): fixture = fixtures.ServiceFixture() project = fixture.project resource = fixture.resource class TestExtension(object): @staticmethod def get_cleanup_executor(): return TestExecutor get_extensions.return_value = [TestExtension] executors.ProjectCleanupExecutor.execute(fixture.project, async=False) self.assertFalse(models.Project.objects.filter(id=project.id).exists()) self.assertFalse( test_models.TestNewInstance.objects.filter( id=resource.id).exists())
def setUp(self): self.fixture = fixtures.ServiceFixture()
def setUp(self): self.fixture = fixtures.ServiceFixture() self.client.force_authenticate(user=self.fixture.staff)