def setUp(self):
        super(BaseBackendTest, self).setUp()

        self.fixture = fixtures.SupportFixture()
        self.backend = ServiceDeskBackend()

        jira_patcher = mock.patch('waldur_jira.backend.JIRA')
        self.mocked_jira = jira_patcher.start()()

        self.mocked_jira.fields.return_value = [
            {
                'clauseNames': 'Caller',
                'id': 'field101',
            },
            {
                'clauseNames': 'Original Reporter',
                'id': 'field102',
            },
            {
                'clauseNames': 'Time to first response',
                'id': 'field103',
            },
            {
                'clauseNames': 'Impact',
                'id': 'field104',
            },
        ]
 def test_when_offering_is_created_total_is_updated(self, scope):
     fixture = support_fixtures.SupportFixture()
     offering = fixture.offering
     offering.state = support_models.Offering.States.OK
     offering.save()
     estimate = models.PriceEstimate.objects.get(scope=getattr(fixture, scope))
     self.assertEqual(estimate.total, offering.unit_price * 31)
    def test_scope_type_is_rendered_for_support_request(self):
        fixture = support_fixtures.SupportFixture()
        invoice = factories.InvoiceFactory(customer=fixture.customer)
        models.GenericInvoiceItem.objects.create(scope=fixture.offering,
                                                 invoice=invoice)
        url = factories.InvoiceFactory.get_url(invoice)

        self.client.force_authenticate(fixture.owner)
        response = self.client.get(url)
        item = response.data['items'][0]
        self.assertEqual(item['scope_type'], 'Support.Offering')
    def setUp(self):
        self.fixture = support_fixtures.SupportFixture()
        self.start_date = timezone.datetime(2014, 2, 7, tzinfo=pytz.UTC)

        with freeze_time(self.start_date):
            self.offering = self.fixture.offering
            self.offering.state = self.offering.States.OK
            self.offering.save()
            self.assertEqual(models.Invoice.objects.count(), 1)
            self.invoice = models.Invoice.objects.first()
            self.offering.state = self.offering.States.REQUESTED
            self.offering.save()
            self.assertEqual(models.Invoice.objects.count(), 1)
    def setUp(self):
        super(BaseBackendTest, self).setUp()

        self.fixture = fixtures.SupportFixture()
        self.backend = ServiceDeskBackend()

        jira_patcher = mock.patch('waldur_jira.backend.JIRA')
        self.mocked_jira = jira_patcher.start()()

        self.mocked_jira.fields.return_value = json.loads(load_resource('jira_fields.json'))

        mock_backend_users = [User({'server': ''}, None, raw={'key': 'user_1', 'active': True})]
        self.mocked_jira.search_users.return_value = mock_backend_users
Exemple #6
0
 def setUp(self):
     self.fixture = support_fixtures.SupportFixture()
     self.offering = marketplace_factories.OfferingFactory(type=PLUGIN_NAME)
     offering_component = marketplace_factories.OfferingComponentFactory(
         offering=self.offering)
     self.plan = marketplace_factories.PlanFactory(
         unit=marketplace_models.Plan.Units.PER_MONTH)
     self.plan_component = marketplace_factories.PlanComponentFactory(
         plan=self.plan,
         component=offering_component,
         price=7,
     )
     self.resource = marketplace_factories.ResourceFactory(
         offering=self.offering,
         project=self.fixture.project,
         plan=self.plan,
     )
 def setUp(self):
     self.fixture = support_fixtures.SupportFixture()