コード例 #1
0
    def test_panoptes_enrichment_set(self):
        enrichment_set1 = PanoptesEnrichmentSet('int_001')
        enrichment_set1.add('speed', 1000)
        enrichment_set1.add('index', 001)
        enrichment_set1.add('status', 'up')
        self.assertEquals(
            enrichment_set1.json(),
            '{"int_001": {"index": 1, "speed": 1000, "status": "up"}}')
        self.assertEquals(
            repr(enrichment_set1),
            "PanoptesEnrichmentSet({'int_001': {'status': 'up', 'index': 1, 'speed': 1000}})"
        )

        enrichment_set2 = PanoptesEnrichmentSet('int_002')
        enrichment_set2.add('speed', 1000)
        enrichment_set2.add('index', 002)
        enrichment_set2.add('status', 'down')

        interface_validation_object = PanoptesEnrichmentInterfaceSchemaValidator(
        )
        enrichment_group1 = PanoptesEnrichmentGroup(
            'interface', interface_validation_object, 300, 60)

        self.assertFalse(enrichment_set1 == enrichment_group1)
        self.assertFalse(enrichment_set1 == enrichment_set2)
コード例 #2
0
    def test_panoptes_enrichment_set(self):
        enrichment_set1 = PanoptesEnrichmentSet(u'int_001')
        enrichment_set1.add(u'speed', 1000)
        enrichment_set1.add(u'index', 0o01)
        enrichment_set1.add(u'status', u'up')
        self.assertEquals(enrichment_set1.json(),
                          u'{"int_001": {"index": 1, "speed": 1000, "status": "up"}}')
        self.assertEquals(repr(enrichment_set1),
                          u"PanoptesEnrichmentSet[int_001[index:1,speed:1000,status:up]]")

        enrichment_set2 = PanoptesEnrichmentSet(u'int_002')
        enrichment_set2.add(u'speed', 1000)
        enrichment_set2.add(u'index', 0o02)
        enrichment_set2.add(u'status', u'down')

        interface_validation_object = PanoptesEnrichmentInterfaceSchemaValidator()
        enrichment_group1 = PanoptesEnrichmentGroup(u'interface', interface_validation_object, 300, 60)

        self.assertFalse(enrichment_set1 == enrichment_group1)
        self.assertFalse(enrichment_set1 == enrichment_set2)