Exemplo n.º 1
0
    def test_EnumStringMetricStateContainer(self):
        dc = descriptorcontainers.EnumStringMetricDescriptorContainer(
            nsmapper=self.nsmapper,
            nodeName='MyDescriptor',
            handle='123',
            parentHandle='456')

        sc = statecontainers.EnumStringMetricStateContainer(
            nsmapper=self.nsmapper, descriptorContainer=dc, node=None)
        sc.mkMetricValue()
        self.assertTrue(isinstance(sc.metricValue, pmtypes.StringMetricValue))
    def test_EnumStringMetricDescriptorContainer(self):
        dc = descriptorcontainers.EnumStringMetricDescriptorContainer(
            nsmapper=self.nsmapper,
            nodeName=namespaces.domTag('MyDescriptor'),
            handle='123',
            parentHandle='456',
        )
        dc.AllowedValue = [pmtypes.AllowedValue('abc')]

        node = dc.mkNode()
        print(etree_.tostring(node, pretty_print=True))
        dc2 = descriptorcontainers.EnumStringMetricDescriptorContainer.fromNode(
            nsmapper=self.nsmapper, node=node, parentHandle='467')
        self.assertEqual(dc.AllowedValue, dc2.AllowedValue)