def test_a_getset(self): z = Zone() record = {'ttl': 300, 'addr': '10.0.0.1', 'alias': '@'} self.assertEqual(z.a(), []) self.assertEqual(z.a(record), [{'ttl': 300, 'addr': '10.0.0.1', 'alias': '@'}]) self.assertEqual(z.a(record), [{'ttl': 300, 'addr': '10.0.0.1', 'alias': '@'}])
def test_remove(self): z = Zone() z.contents['A'] = [{'addr': '10.0.0.1', 'alias': 'abc', 'ttl': 300}] z.remove('alias', 'A', 'abc') self.assertEqual(z.a(), []) with self.assertRaises(IndexError): z.remove('alias', 'NOPE', 'abc') with self.assertRaises(KeyError): z.remove('alias', 'A', 'abc')