

def test_prefix_indent_ipv4(self):
    ' Check that our indentation calculation is working for IPv4\n\n            Prefixes gets an indent value automatically assigned to help in\n            displaying prefix information. The indent value is written on\n            updates to the table and this test is to make sure it is correctly\n            calculated.\n        '
    schema = {
        'id': self.schema_attrs['id'],
    }
    p1 = self.nipap.list_prefix(self.auth, schema, {
        'prefix': '1.3.3.1/32',
    })[0]
    p2 = self.nipap.list_prefix(schema.auth, schema, {
        'prefix': '1.3.3.0/24',
    })[0]
    p3 = self.nipap.list_prefix(self.auth, schema, {
        'prefix': '1.3.0.0/16',
    })[0]
    self.assertEqual(p1['indent'], 4, 'Indent calc on add failed')
    self.assertEqual(p2['indent'], 3, 'Indent calc on add failed')
    self.assertEqual(p3['indent'], 0, 'Indent calc on add failed')
    self.nipap.remove_prefix(self.auth, schema, {
        'id': self.prefix_attrs2['id'],
    })
    p1 = self.nipap.list_prefix(self.auth, schema, {
        'prefix': '1.3.3.1/32',
    })[0]
    p3 = self.nipap.list_prefix(self.auth, schema, {
        'prefix': '1.3.0.0/16',
    })[0]
    self.assertEqual(p1['indent'], 3, 'Indent calc on remove failed')
    self.assertEqual(p3['indent'], 0, 'Indent calc on remove failed')

dataset/ETHPy150Open SpriteLink/NIPAP/tests/nipapbase.py NipapTest.test_prefix_indent_ipv4/VarMisuse@63/193 `self`->`schema`