Exemplo n.º 1
0
 def test_metric_create(self):
     name = "TEST_CREATE_FOOBAR" + TestUtils.random_string(6)
     display_name = "TEST_METRIC_CREATE" + TestUtils.random_string(6)
     display_name_short = "TEST_METRIC" + TestUtils.random_string(6)
     description = TestUtils.random_string(32)
     default_aggregate = aggregates.AVG
     default_resolution = 60000
     unit = units.DURATION
     _type = 'FOO'
     is_disabled = True
     metric = self.api.metric_create(name=name,
                                     display_name=display_name,
                                     display_name_short=display_name_short,
                                     description=description,
                                     default_aggregate=default_aggregate,
                                     default_resolution=default_resolution,
                                     unit=unit,
                                     _type=_type,
                                     is_disabled=is_disabled)
     self.assertEqual(name, metric.name)
     self.assertEqual(display_name, metric.display_name)
     self.assertEqual(display_name_short, metric.display_name_short)
     self.assertEqual(description, metric.description)
     self.assertEqual(default_aggregate.upper(), metric.default_aggregate)
     self.assertEqual(default_resolution, metric.default_resolution)
     self.assertEqual(unit, metric.unit)
     self.assertEqual(_type, metric.type)
     self.assertEqual(is_disabled, metric.is_disabled)
Exemplo n.º 2
0
 def test_metric_create(self):
     name = "TEST_CREATE_FOOBAR" + TestUtils.random_string(6)
     display_name = "TEST_METRIC_CREATE" + TestUtils.random_string(6)
     display_name_short = "TEST_METRIC" + TestUtils.random_string(6)
     description = TestUtils.random_string(32)
     default_aggregate = aggregates.AVG
     default_resolution = 60000
     unit = units.DURATION
     _type = "FOO"
     is_disabled = True
     metric = self.api.metric_create(
         name=name,
         display_name=display_name,
         display_name_short=display_name_short,
         description=description,
         default_aggregate=default_aggregate,
         default_resolution=default_resolution,
         unit=unit,
         _type=_type,
         is_disabled=is_disabled,
     )
     self.assertEqual(name, metric.name)
     self.assertEqual(display_name, metric.display_name)
     self.assertEqual(display_name_short, metric.display_name_short)
     self.assertEqual(description, metric.description)
     self.assertEqual(default_aggregate.upper(), metric.default_aggregate)
     self.assertEqual(default_resolution, metric.default_resolution)
     self.assertEqual(unit, metric.unit)
     self.assertEqual(_type, metric.type)
     self.assertEqual(is_disabled, metric.is_disabled)
Exemplo n.º 3
0
 def test_metric_bad_unit(self):
     try:
         name = "TEST_CREATE" + TestUtils.random_string(6)
         display_name = TestUtils.random_string(32)
         metric = self.api.metric_create(name=name, display_name=display_name, unit="foo")
         self.assertTrue(False)
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.unprocessable_entity, e.status_code)
Exemplo n.º 4
0
 def test_metric_bad_unit(self):
     try:
         name = 'TEST_CREATE' + TestUtils.random_string(6)
         display_name = TestUtils.random_string(32)
         metric = self.api.metric_create(name=name,
                                         display_name=display_name,
                                         unit='foo')
         self.assertTrue(False)
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.unprocessable_entity,
                          e.status_code)
Exemplo n.º 5
0
 def test_metric_large_display_name(self):
     """
     Test to see that we can handle a display name up to 1K characters
     :return:
     """
     try:
         name = "TEST_CREATE" + TestUtils.random_string(6)
         display_name = TestUtils.random_string(1024 * 1024)
         metric = self.api.metric_create(name=name, display_name=display_name)
         self.assertTrue(True)
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.request_entity_too_large, e.status_code)
Exemplo n.º 6
0
 def test_metric_large_short_display_name(self):
     """
     Test on the limit of the short display name
     :return:
     """
     try:
         name = "TEST_CREATE" + TestUtils.random_string(6)
         display_name_short = TestUtils.random_string(1024 * 1024)
         metric = self.api.metric_create(name=name, display_name_short=display_name_short)
         self.assertTrue(True)
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.request_entity_too_large, e.status_code)
Exemplo n.º 7
0
    def test_repr_(self):
        created_at = int(datetime.now().strftime('%s'))
        event_id = random.randrange(1, 1000000000)
        fingerprint_fields = '@title'
        id = random.randrange(1, 1000000000)
        event_class = 'CHANGE'
        message = TestUtils.random_string(32)
        properties = {"foo": "bar", "color": "red"}
        received_at = int(datetime.now().strftime('%s'))
        sender = TestUtils.random_string(10)
        severity = 'INFO'
        source = Source(ref=TestUtils.random_string(10), _type='host', name='foobar')
        status = 'OPEN'
        tags = {"foo": "bar", "color": "red"}
        tenant_id = random.randrange(1, 10000000)
        title = TestUtils.random_string(16)
        raw_event = RawEvent(
            created_at=created_at,
            event_id=event_id,
            event_class=event_class,
            fingerprint_fields=fingerprint_fields,
            id=id,
            message=message,
            properties=properties,
            received_at=received_at,
            sender=sender,
            severity=severity,
            source=source,
            status=status,
            tags=tags,
            tenant_id=tenant_id,
            title=title
        )
        expected = []
        expected.append("RawEvent(created_at={0}".format(created_at, event_id))
        expected.append(", event_id='{0}'".format(event_id))
        expected.append(", event_class='{0}'".format(event_class))
        expected.append(", fingerprint_fields='{0}'".format(fingerprint_fields))
        expected.append(", id='{0}'".format(id))
        expected.append(", message='{0}'".format(message))
        expected.append(", properties={0}".format(properties))
        expected.append(", source='{0}'".format(source))
        expected.append(", sender='{0}'".format(sender))
        expected.append(", severity='{0}'".format(severity))
        expected.append(", status='{0}'".format(status))
        expected.append(", tags='{0}'".format(tags))
        expected.append(", tenant_id={0}".format(tenant_id))
        expected.append(", title='{0}')".format(title))

        expected = "".join(expected)

        self.assertEqual(expected, raw_event.__repr__())
Exemplo n.º 8
0
 def test_metric_large_short_display_name(self):
     """
     Test on the limit of the short display name
     :return:
     """
     try:
         name = 'TEST_CREATE' + TestUtils.random_string(6)
         display_name_short = TestUtils.random_string(1024 * 1024)
         metric = self.api.metric_create(
             name=name, display_name_short=display_name_short)
         self.assertTrue(True)
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.request_entity_too_large,
                          e.status_code)
Exemplo n.º 9
0
 def test_metric_large_display_name(self):
     """
     Test to see that we can handle a display name up to 1K characters
     :return:
     """
     try:
         name = 'TEST_CREATE' + TestUtils.random_string(6)
         display_name = TestUtils.random_string(1024 * 1024)
         metric = self.api.metric_create(name=name,
                                         display_name=display_name)
         self.assertTrue(True)
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.request_entity_too_large,
                          e.status_code)
Exemplo n.º 10
0
    def setUp(self):
        self.api = API()
        logging.basicConfig(level=logging.DEBUG)
        self.name = 'TEST_' + TestUtils.random_string(6)
        self.display_name = 'green'
        self.display_name_short = 'blue'
        self.description = 'magenta'
        self.default_aggregate = aggregates.SUM
        self.default_resolution = 60000
        self.unit = units.DURATION
        self.type = 'FOOBAR'
        self.is_disabled = False
        self.metric = Metric(name=self.name,
                             display_name=self.display_name,
                             display_name_short=self.display_name_short,
                             description=self.description,
                             default_aggregate=self.default_aggregate,
                             default_resolution=self.default_resolution,
                             unit=self.unit,
                             _type=self.type,
                             is_disabled=self.is_disabled)

        self.api.metric_create_batch([self.metric])

        logging.basicConfig(level=logging.INFO)
Exemplo n.º 11
0
    def setUp(self):
        self.api = API()
        logging.basicConfig(level=logging.DEBUG)
        self.name = "TEST_" + TestUtils.random_string(6)
        self.display_name = "green"
        self.display_name_short = "blue"
        self.description = "magenta"
        self.default_aggregate = aggregates.SUM
        self.default_resolution = 60000
        self.unit = units.DURATION
        self.type = "FOOBAR"
        self.is_disabled = False
        self.metric = Metric(
            name=self.name,
            display_name=self.display_name,
            display_name_short=self.display_name_short,
            description=self.description,
            default_aggregate=self.default_aggregate,
            default_resolution=self.default_resolution,
            unit=self.unit,
            _type=self.type,
            is_disabled=self.is_disabled,
        )

        self.api.metric_create_batch([self.metric])

        logging.basicConfig(level=logging.INFO)
Exemplo n.º 12
0
    def test_measurement_get(self):
        metric = 'CPU'
        value = 0.0
        source = 'API_TEST_SOURCE' + TestUtils.random_string(6)
        properties = {
            "app_id": "red",
            "source_type": "blue",
            "origin": "green"
        }
        start = int(datetime.now().strftime('%s'))
        timestamp = start
        for i in range(0, 10):
            self.api.measurement_create(metric=metric,
                                        value=value,
                                        source=source,
                                        timestamp=timestamp,
                                        properties=properties)
            timestamp += 1
            value += 0.1

        measurements = self.api.measurement_get(source=source,
                                                start=start,
                                                aggregate='avg')
        value = 0.0
        timestamp = start
        for measure in measurements:
            self.assertEqual(metric, measure.metric)
            self.assertEqual(value, measure.value)
            self.assertEqual(source, measure.source)
            self.assertEqual(timestamp, measure.timestamp / 1000)
            timestamp += 1
            value += 0.1
Exemplo n.º 13
0
    def test_metric_create_one_batch(self):
        name = "TEST_CREATE_BATCH_ONE_FOOBAR" + TestUtils.random_string(6)
        display_name = "BATCH" + TestUtils.random_string(6)
        display_name_short = "BATCH" + TestUtils.random_string(3)
        description = TestUtils.random_string(32)
        default_aggregate = aggregates.SUM
        default_resolution = random.randrange(1000, 60000)
        unit = units.PERCENT
        _type = "FOO"
        is_disabled = True

        metric1 = Metric(
            name=name,
            display_name=display_name,
            display_name_short=display_name_short,
            description=description,
            default_aggregate=default_aggregate,
            default_resolution=default_resolution,
            unit=unit,
            _type=_type,
            is_disabled=is_disabled,
        )

        metrics = self.api.metric_create_batch([metric1])
        self.assertEqual(len(metrics), 1)

        m = metrics[0]
        self.assertEqual(name, m.name)
        self.assertEqual(display_name, m.display_name)
        self.assertEqual(display_name_short, m.display_name_short)
        self.assertEqual(description, m.description)
        self.assertEqual(default_aggregate.upper(), m.default_aggregate)
        self.assertEqual(default_resolution, m.default_resolution)
        self.assertEqual(unit, m.unit)
        self.assertEqual(_type, m.type)
        self.assertEqual(is_disabled, m.is_disabled)

        self.api.metric_delete(name)
Exemplo n.º 14
0
    def test_metric_update(self):
        name = "TEST_UPDATE_" + TestUtils.random_string(6)
        display_name = TestUtils.random_string(8)
        display_name_short = TestUtils.random_string(16)
        description = TestUtils.random_string(16)
        default_aggregate = aggregates.SUM
        default_resolution = 60000
        unit = units.PERCENT
        is_disabled = False
        _type = "DEVICE"
        self.api.metric_create(
            name=name,
            display_name=display_name,
            display_name_short=display_name_short,
            description=description,
            default_aggregate=default_aggregate,
            default_resolution=default_resolution,
            unit=unit,
            is_disabled=is_disabled,
            _type=_type,
        )

        display_name = TestUtils.random_string(8)
        display_name_short = TestUtils.random_string(16)
        description = TestUtils.random_string(16)
        default_aggregate = aggregates.MAX
        default_resolution = 30000
        unit = units.DURATION
        is_disabled = True
        _type = "HOST"
        metric = self.api.metric_update(
            name=name,
            display_name=display_name,
            display_name_short=display_name_short,
            description=description,
            default_aggregate=default_aggregate,
            default_resolution=default_resolution,
            unit=unit,
            is_disabled=is_disabled,
            _type=_type,
        )

        self.assertEqual(name, metric.name)
        self.assertEqual(display_name, metric.display_name)
        self.assertEqual(display_name_short, metric.display_name_short)
        self.assertEqual(description, metric.description)
        self.assertEqual(default_aggregate.upper(), metric.default_aggregate)
        self.assertEqual(default_resolution, metric.default_resolution)
        self.assertEqual(unit, metric.unit)
        self.assertEqual(_type, metric.type)
        self.assertEqual(is_disabled, metric.is_disabled)

        self.api.metric_delete(name)
Exemplo n.º 15
0
    def test_metric_create_one_batch(self):
        name = 'TEST_CREATE_BATCH_ONE_FOOBAR' + TestUtils.random_string(6)
        display_name = "BATCH" + TestUtils.random_string(6)
        display_name_short = "BATCH" + TestUtils.random_string(3)
        description = TestUtils.random_string(32)
        default_aggregate = aggregates.SUM
        default_resolution = random.randrange(1000, 60000)
        unit = units.PERCENT
        _type = 'FOO'
        is_disabled = True

        metric1 = Metric(name=name,
                         display_name=display_name,
                         display_name_short=display_name_short,
                         description=description,
                         default_aggregate=default_aggregate,
                         default_resolution=default_resolution,
                         unit=unit,
                         _type=_type,
                         is_disabled=is_disabled)

        metrics = self.api.metric_create_batch([metric1])
        self.assertEqual(len(metrics), 1)

        m = metrics[0]
        self.assertEqual(name, m.name)
        self.assertEqual(display_name, m.display_name)
        self.assertEqual(display_name_short, m.display_name_short)
        self.assertEqual(description, m.description)
        self.assertEqual(default_aggregate.upper(), m.default_aggregate)
        self.assertEqual(default_resolution, m.default_resolution)
        self.assertEqual(unit, m.unit)
        self.assertEqual(_type, m.type)
        self.assertEqual(is_disabled, m.is_disabled)

        self.api.metric_delete(name)
Exemplo n.º 16
0
    def test_metric_update(self):
        name = 'TEST_UPDATE_' + TestUtils.random_string(6)
        display_name = TestUtils.random_string(8)
        display_name_short = TestUtils.random_string(16)
        description = TestUtils.random_string(16)
        default_aggregate = aggregates.SUM
        default_resolution = 60000
        unit = units.PERCENT
        is_disabled = False
        _type = 'DEVICE'
        self.api.metric_create(name=name,
                               display_name=display_name,
                               display_name_short=display_name_short,
                               description=description,
                               default_aggregate=default_aggregate,
                               default_resolution=default_resolution,
                               unit=unit,
                               is_disabled=is_disabled,
                               _type=_type)

        display_name = TestUtils.random_string(8)
        display_name_short = TestUtils.random_string(16)
        description = TestUtils.random_string(16)
        default_aggregate = aggregates.MAX
        default_resolution = 30000
        unit = units.DURATION
        is_disabled = True
        _type = 'HOST'
        metric = self.api.metric_update(name=name,
                                        display_name=display_name,
                                        display_name_short=display_name_short,
                                        description=description,
                                        default_aggregate=default_aggregate,
                                        default_resolution=default_resolution,
                                        unit=unit,
                                        is_disabled=is_disabled,
                                        _type=_type)

        self.assertEqual(name, metric.name)
        self.assertEqual(display_name, metric.display_name)
        self.assertEqual(display_name_short, metric.display_name_short)
        self.assertEqual(description, metric.description)
        self.assertEqual(default_aggregate.upper(), metric.default_aggregate)
        self.assertEqual(default_resolution, metric.default_resolution)
        self.assertEqual(unit, metric.unit)
        self.assertEqual(_type, metric.type)
        self.assertEqual(is_disabled, metric.is_disabled)

        self.api.metric_delete(name)
Exemplo n.º 17
0
    def test_measurement_get(self):
        metric = 'CPU'
        value = 0.0
        source = 'API_TEST_SOURCE' + TestUtils.random_string(6)
        properties = {"app_id": "red", "source_type": "blue", "origin": "green"}
        start = int(datetime.now().strftime('%s'))
        timestamp = start
        for i in range(0, 10):
            self.api.measurement_create(metric=metric, value=value, source=source,
                                        timestamp=timestamp, properties=properties)
            timestamp += 1
            value += 0.1

        measurements = self.api.measurement_get(source=source, start=start, aggregate='avg')
        value = 0.0
        timestamp = start
        for measure in measurements:
            self.assertEqual(metric, measure.metric)
            self.assertEqual(value, measure.value)
            self.assertEqual(source, measure.source)
            self.assertEqual(timestamp, measure.timestamp/1000)
            timestamp += 1
            value += 0.1
Exemplo n.º 18
0
    def test_metric_create_multiple_batch(self):
        name1 = "TEST_CREATE_BATCH_ONE_FOOBAR" + TestUtils.random_string(6)
        name2 = "TEST_CREATE_BATCH_TWO_FOOBAR" + TestUtils.random_string(6)
        name3 = "TEST_CREATE_BATCH_THREE_FOOBAR" + TestUtils.random_string(6)
        name4 = "TEST_CREATE_BATCH_FOUR_FOOBAR" + TestUtils.random_string(6)

        display_name1 = "TEST_DISPLAY_NAME" + TestUtils.random_string(6)
        display_name2 = "TEST_DISPLAY_NAME" + TestUtils.random_string(6)
        display_name3 = "TEST_DISPLAY_NAME" + TestUtils.random_string(6)
        display_name4 = "TEST_DISPLAY_NAME" + TestUtils.random_string(6)

        display_name_short1 = "TEST_SHORT" + TestUtils.random_string(10)
        display_name_short2 = "TEST_SHORT" + TestUtils.random_string(10)
        display_name_short3 = "TEST_SHORT" + TestUtils.random_string(10)
        display_name_short4 = "TEST_SHORT" + TestUtils.random_string(10)

        description1 = TestUtils.random_string(32)
        description2 = TestUtils.random_string(32)
        description3 = TestUtils.random_string(32)
        description4 = TestUtils.random_string(32)

        default_aggregate1 = aggregates.AVG
        default_aggregate2 = aggregates.MIN
        default_aggregate3 = aggregates.MAX
        default_aggregate4 = aggregates.SUM

        default_resolution1 = random.randrange(1000, 60000)
        default_resolution2 = random.randrange(1000, 60000)
        default_resolution3 = random.randrange(1000, 60000)
        default_resolution4 = random.randrange(1000, 60000)

        unit1 = units.BYTECOUNT
        unit2 = units.DURATION
        unit3 = units.NUMBER
        unit4 = units.PERCENT

        is_disabled1 = True
        is_disabled2 = False
        is_disabled3 = True
        is_disabled4 = False

        _type1 = TestUtils.random_string(6)
        _type2 = TestUtils.random_string(6)
        _type3 = TestUtils.random_string(6)
        _type4 = TestUtils.random_string(6)

        new_metrics = [
            Metric(
                name=name1,
                display_name=display_name1,
                display_name_short=display_name_short1,
                description=description1,
                default_aggregate=default_aggregate1,
                default_resolution=default_resolution1,
                unit=unit1,
                _type=_type1,
                is_disabled=is_disabled1,
            ),
            Metric(
                name=name2,
                display_name=display_name2,
                display_name_short=display_name_short2,
                description=description2,
                default_aggregate=default_aggregate2,
                default_resolution=default_resolution2,
                unit=unit2,
                _type=_type2,
                is_disabled=is_disabled2,
            ),
            Metric(
                name=name3,
                display_name=display_name3,
                display_name_short=display_name_short3,
                description=description3,
                default_aggregate=default_aggregate3,
                default_resolution=default_resolution3,
                unit=unit3,
                _type=_type3,
                is_disabled=is_disabled3,
            ),
            Metric(
                name=name4,
                display_name=display_name4,
                display_name_short=display_name_short4,
                description=description4,
                default_aggregate=default_aggregate4,
                default_resolution=default_resolution4,
                unit=unit4,
                _type=_type4,
                is_disabled=is_disabled4,
            ),
        ]

        metrics = self.api.metric_create_batch(new_metrics)

        self.assertEqual(4, len(metrics))
Exemplo n.º 19
0
 def test_create_event_with_finger_print_fields(self):
     fingerprint_fields = ['@message']
     source = Source(ref='localhost', _type='host', name='bubba')
     message = 'hello' + TestUtils.random_string(6)
     dt = datetime.now()
     self.api.event_create(message=message, created_at=dt, title='Hello World', fingerprint_fields=fingerprint_fields, source=source)
Exemplo n.º 20
0
 def test_create(self):
     self.api.hostgroup_create('test' + TestUtils.random_string(6),
                               ['red', 'green', 'blue'])
Exemplo n.º 21
0
    def test_metric_create_multiple_batch(self):
        name1 = 'TEST_CREATE_BATCH_ONE_FOOBAR' + TestUtils.random_string(6)
        name2 = 'TEST_CREATE_BATCH_TWO_FOOBAR' + TestUtils.random_string(6)
        name3 = 'TEST_CREATE_BATCH_THREE_FOOBAR' + TestUtils.random_string(6)
        name4 = 'TEST_CREATE_BATCH_FOUR_FOOBAR' + TestUtils.random_string(6)

        display_name1 = 'TEST_DISPLAY_NAME' + TestUtils.random_string(6)
        display_name2 = 'TEST_DISPLAY_NAME' + TestUtils.random_string(6)
        display_name3 = 'TEST_DISPLAY_NAME' + TestUtils.random_string(6)
        display_name4 = 'TEST_DISPLAY_NAME' + TestUtils.random_string(6)

        display_name_short1 = 'TEST_SHORT' + TestUtils.random_string(10)
        display_name_short2 = 'TEST_SHORT' + TestUtils.random_string(10)
        display_name_short3 = 'TEST_SHORT' + TestUtils.random_string(10)
        display_name_short4 = 'TEST_SHORT' + TestUtils.random_string(10)

        description1 = TestUtils.random_string(32)
        description2 = TestUtils.random_string(32)
        description3 = TestUtils.random_string(32)
        description4 = TestUtils.random_string(32)

        default_aggregate1 = aggregates.AVG
        default_aggregate2 = aggregates.MIN
        default_aggregate3 = aggregates.MAX
        default_aggregate4 = aggregates.SUM

        default_resolution1 = random.randrange(1000, 60000)
        default_resolution2 = random.randrange(1000, 60000)
        default_resolution3 = random.randrange(1000, 60000)
        default_resolution4 = random.randrange(1000, 60000)

        unit1 = units.BYTECOUNT
        unit2 = units.DURATION
        unit3 = units.NUMBER
        unit4 = units.PERCENT

        is_disabled1 = True
        is_disabled2 = False
        is_disabled3 = True
        is_disabled4 = False

        _type1 = TestUtils.random_string(6)
        _type2 = TestUtils.random_string(6)
        _type3 = TestUtils.random_string(6)
        _type4 = TestUtils.random_string(6)

        new_metrics = [
            Metric(name=name1,
                   display_name=display_name1,
                   display_name_short=display_name_short1,
                   description=description1,
                   default_aggregate=default_aggregate1,
                   default_resolution=default_resolution1,
                   unit=unit1,
                   _type=_type1,
                   is_disabled=is_disabled1),
            Metric(name=name2,
                   display_name=display_name2,
                   display_name_short=display_name_short2,
                   description=description2,
                   default_aggregate=default_aggregate2,
                   default_resolution=default_resolution2,
                   unit=unit2,
                   _type=_type2,
                   is_disabled=is_disabled2),
            Metric(name=name3,
                   display_name=display_name3,
                   display_name_short=display_name_short3,
                   description=description3,
                   default_aggregate=default_aggregate3,
                   default_resolution=default_resolution3,
                   unit=unit3,
                   _type=_type3,
                   is_disabled=is_disabled3),
            Metric(name=name4,
                   display_name=display_name4,
                   display_name_short=display_name_short4,
                   description=description4,
                   default_aggregate=default_aggregate4,
                   default_resolution=default_resolution4,
                   unit=unit4,
                   _type=_type4,
                   is_disabled=is_disabled4)
        ]

        metrics = self.api.metric_create_batch(new_metrics)

        self.assertEqual(4, len(metrics))
Exemplo n.º 22
0
 def test_metric_delete(self):
     name = "TEST_DELETE_FOOBAR" + TestUtils.random_string(6)
     self.api.metric_create(name=name)
     self.api.metric_delete(name)
Exemplo n.º 23
0
 def test_metric_delete_name_does_not_exist(self):
     try:
         self.api.metric_delete(TestUtils.random_string(10))
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.unprocessable_entity, e.status_code)
Exemplo n.º 24
0
 def test_metric_delete(self):
     name = 'TEST_DELETE_FOOBAR' + TestUtils.random_string(6)
     self.api.metric_create(name=name)
     self.api.metric_delete(name)
Exemplo n.º 25
0
 def test_metric_delete_name_does_not_exist(self):
     try:
         self.api.metric_delete(TestUtils.random_string(10))
     except HTTPResponseError as e:
         self.assertEqual(requests.codes.unprocessable_entity,
                          e.status_code)
Exemplo n.º 26
0
 def test_create(self):
     self.api.hostgroup_create("test" + TestUtils.random_string(6), ["red", "green", "blue"])