Exemplo n.º 1
0
 def test_invalid_key(self):
     """
     Test we reject invalid key.
     """
     self.assertEqual("TSIG: Invalid TSIG key string: invalid.key",
                      tsig_keys.check({'keys': ['invalid.key']}))
     self.assertEqual("TSIG: Incomplete input for base64: 123",
                      tsig_keys.check({'keys': ['invalid.key:123']}))
Exemplo n.º 2
0
 def test_bad_format(self):
     """
     Test we fail on bad format. We don't really care much how here, though,
     as this should not get in through config manager anyway.
     """
     self.assertNotEqual(None, tsig_keys.check({'bad_name': {}}))
     self.assertNotEqual(None, tsig_keys.check({'keys': 'not_list'}))
     self.assertNotEqual(None, tsig_keys.check({'keys': 42}))
     self.assertNotEqual(None, tsig_keys.check({'keys': {}}))
Exemplo n.º 3
0
 def test_invalid_key(self):
     """
     Test we reject invalid key.
     """
     self.assertEqual("TSIG: Invalid TSIG key string: invalid.key",
                      tsig_keys.check({'keys': ['invalid.key']}))
     self.assertEqual(
         "TSIG: Unexpected end of input in BASE decoder",
         tsig_keys.check({'keys': ['invalid.key:123']}))
Exemplo n.º 4
0
 def test_bad_format(self):
     """
     Test we fail on bad format. We don't really care much how here, though,
     as this should not get in trough config manager anyway.
     """
     self.assertNotEqual(None, tsig_keys.check({'bad_name': {}}))
     self.assertNotEqual(None, tsig_keys.check({'keys': 'not_list'}))
     self.assertNotEqual(None, tsig_keys.check({'keys': 42}))
     self.assertNotEqual(None, tsig_keys.check({'keys': {}}))
Exemplo n.º 5
0
 def test_invalid_key(self):
     """
     Test we reject invalid key.
     """
     self.assertEqual("TSIG: Invalid TSIG key string: invalid.key",
                      tsig_keys.check({'keys': ['invalid.key']}))
     self.assertEqual(
         "TSIG: Incomplete input for base64: 123",
         tsig_keys.check({'keys': ['invalid.key:123']}))
Exemplo n.º 6
0
 def test_keys_same_name(self):
     """
     Test we reject when we have multiple keys with the same name.
     """
     self.assertEqual("Multiple TSIG keys with name 'test.key.'",
                      tsig_keys.check({'keys':
                                      ['test.key:QklORCAxMCBpcyBjb29sCg==',
                                       'test.key:b3RoZXIK']}))
Exemplo n.º 7
0
 def test_keys_valid(self):
     """
     Check we accept some valid keys (we don't check all the algorithms,
     that's the job of isc.dns.TSIGKey).
     """
     self.assertEqual(None, tsig_keys.check({'keys':
         ['testkey:QklORCAxMCBpcyBjb29sCg==',
          'test.key:QklORCAxMCBpcyBjb29sCg==:hmac-sha1']}))
Exemplo n.º 8
0
 def test_keys_same_name(self):
     """
     Test we reject when we have multiple keys with the same name.
     """
     self.assertEqual(
         "Multiple TSIG keys with name 'test.key.'",
         tsig_keys.check({
             'keys':
             ['test.key:QklORCAxMCBpcyBjb29sCg==', 'test.key:b3RoZXIK']
         }))
Exemplo n.º 9
0
 def test_keys_valid(self):
     """
     Check we accept some valid keys (we don't check all the algorithms,
     that's the job of isc.dns.TSIGKey).
     """
     self.assertEqual(
         None,
         tsig_keys.check({
             'keys': [
                 'testkey:QklORCAxMCBpcyBjb29sCg==',
                 'test.key:QklORCAxMCBpcyBjb29sCg==:hmac-sha1'
             ]
         }))
Exemplo n.º 10
0
 def test_data_empty(self):
     """Check we accept valid config with empty set of tsig keys."""
     self.assertEqual(None, tsig_keys.check({'keys': []}))
Exemplo n.º 11
0
 def test_missing_keys(self):
     """
     Test that missing keys doesn't kill us. There are just no keys there.
     """
     self.assertEqual(None, tsig_keys.check({}))
Exemplo n.º 12
0
 def test_data_empty(self):
     """Check we accept valid config with empty set of tsig keys."""
     self.assertEqual(None, tsig_keys.check({'keys': []}))
Exemplo n.º 13
0
 def test_missing_keys(self):
     """
     Test that missing keys doesn't kill us. There are just no keys there.
     """
     self.assertEqual(None, tsig_keys.check({}))