def test_when_openstack_package_is_extended_project_total_is_updated(self):
        fixture = packages_fixtures.PackageFixture()
        package = fixture.openstack_package
        new_template = packages_factories.PackageTemplateFactory(service_settings=fixture.openstack_service_settings)

        self.client.force_authenticate(user=fixture.owner)
        response = self.client.post(packages_factories.OpenStackPackageFactory.get_list_url(action='change'), data={
            'template': packages_factories.PackageTemplateFactory.get_url(new_template),
            'package': packages_factories.OpenStackPackageFactory.get_url(package),
        })
        self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
    def test_invoice_is_created_monthly(self):
        with freeze_time('2016-11-01 00:00:00'):
            fixture = package_fixtures.PackageFixture()
            package = fixture.openstack_package

        with freeze_time('2016-12-01 00:00:00'):
            invoice = models.Invoice.objects.get(customer=fixture.customer)

            # Create monthly invoices
            tasks.create_monthly_invoices()

            # Check that old invoices has changed the state
            invoice.refresh_from_db()
            self.assertEqual(invoice.state, models.Invoice.States.CREATED)

            # Check that new invoice where created with the same openstack items
            new_invoice = models.Invoice.objects.get(
                customer=fixture.customer, state=models.Invoice.States.PENDING)
            self.assertEqual(package,
                             new_invoice.openstack_items.first().package)
 def setUp(self):
     self.fixture = packages_fixtures.PackageFixture()
     self.package = self.fixture.openstack_package
     self.item = models.OpenStackItem.objects.get(package=self.package)
Beispiel #4
0
 def setUp(self):
     self.fixture = package_fixtures.PackageFixture()
 def test_when_openstack_package_is_created_total_is_updated(self, scope):
     fixture = packages_fixtures.PackageFixture()
     package = fixture.openstack_package
     estimate = models.PriceEstimate.objects.get(scope=getattr(fixture, scope))
     self.assertEqual(estimate.total, package.template.price * 31)
 def setUp(self):
     self.fixture = packages_fixtures.PackageFixture()
     self.package = self.fixture.openstack_package