Пример #1
0
    def test_meters_oops_passing_a_context(self):
        """The service is able to meter an oops passing a context."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(service_meter, 'meter',
                          spec=NamespaceMeter) as meter:
            oops_saved(context='some oops context')

            meter.assert_called_with('oops_saved')
Пример #2
0
    def test_meters_oops_with_normal_meter(self):
        """The service is able to meter an oops by normal meter."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(service_meter, 'meter',
                          spec=NamespaceMeter) as meter:
            oops_saved()

            meter.assert_called_with('oops_saved')
Пример #3
0
    def test_meters_oops_passing_a_report(self):
        """The service is able to meter an oops passing a report."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(service_meter, 'meter',
                          spec=NamespaceMeter) as meter:
            oops_saved(report=dict())

            meter.assert_called_with('oops_saved')
Пример #4
0
    def test_meters_oops_passing_a_context(self):
        """The service is able to meter an oops passing a context."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(service_meter, 'meter',
                          spec=NamespaceMeter) as meter:
            oops_saved(context='some oops context')

            meter.assert_called_with('oops_saved')
Пример #5
0
    def test_meters_oops_passing_a_report(self):
        """The service is able to meter an oops passing a report."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(service_meter, 'meter',
                          spec=NamespaceMeter) as meter:
            oops_saved(report=dict())

            meter.assert_called_with('oops_saved')
Пример #6
0
    def test_meters_oops_with_normal_meter(self):
        """The service is able to meter an oops by normal meter."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(service_meter, 'meter',
                          spec=NamespaceMeter) as meter:
            oops_saved()

            meter.assert_called_with('oops_saved')
Пример #7
0
    def test_meters_oops_by_service(self):
        """The service is able to meter an oops scoped to services."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(METER_UTILITY, 'get_service_meter'):
            METER_UTILITY.get_service_meter.return_value = service_meter

            oops_saved()

            self.assertTrue(METER_UTILITY.get_service_meter.called)
Пример #8
0
    def test_meters_oops_by_service(self):
        """The service is able to meter an oops scoped to services."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(METER_UTILITY, 'get_service_meter'):
            METER_UTILITY.get_service_meter.return_value = service_meter

            oops_saved()

            self.assertTrue(METER_UTILITY.get_service_meter.called)
Пример #9
0
    def test_oops_saved_with_report_with_id(self):
        """oops_saved returns a non-empty list with an id in the report."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(METER_UTILITY, 'get_service_meter'):
            METER_UTILITY.get_service_meter.return_value = service_meter
            the_id = 'an id'
            self.assertEqual([the_id], oops_saved(report=dict(id=the_id)))
Пример #10
0
    def test_oops_saved_with_report_with_no_id(self):
        """oops_saved returns an empty list with no id in the report."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(METER_UTILITY, 'get_service_meter'):
            METER_UTILITY.get_service_meter.return_value = service_meter

            self.assertEqual([], oops_saved(report=dict()))
Пример #11
0
    def test_oops_saved_with_report_with_id(self):
        """oops_saved returns a non-empty list with an id in the report."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(METER_UTILITY, 'get_service_meter'):
            METER_UTILITY.get_service_meter.return_value = service_meter
            the_id = 'an id'
            self.assertEqual([the_id], oops_saved(report=dict(id=the_id)))
Пример #12
0
    def test_oops_saved_with_report_with_no_id(self):
        """oops_saved returns an empty list with no id in the report."""

        service_meter = METER_UTILITY.get_service_meter()

        with patch.object(METER_UTILITY, 'get_service_meter'):
            METER_UTILITY.get_service_meter.return_value = service_meter

            self.assertEqual([], oops_saved(report=dict()))