Esempio n. 1
0
 def test_whitelist_creation(self):
     whitelist = cvmfs.Whitelist(self.sane_whitelist)
     last_modified = datetime.datetime(2015,
                                       6,
                                       3,
                                       9,
                                       55,
                                       27,
                                       tzinfo=tzutc())
     expires = datetime.datetime(2015, 7, 4, 9, 55, 27, tzinfo=tzutc())
     self.assertTrue(hasattr(whitelist, 'last_modified'))
     self.assertTrue(hasattr(whitelist, 'expires'))
     self.assertTrue(hasattr(whitelist, 'repository_name'))
     self.assertTrue(hasattr(whitelist, 'fingerprints'))
     self.assertEqual(last_modified, whitelist.last_modified)
     self.assertEqual(expires, whitelist.expires)
     self.assertEqual('atlas.cern.ch', whitelist.repository_name)
     self.assertEqual(3, len(whitelist.fingerprints))
Esempio n. 2
0
 def test_non_expired_whitelist(self):
     whitelist = cvmfs.Whitelist(self.time_valid_whitelist)
     self.assertFalse(whitelist.expired())
Esempio n. 3
0
 def test_expired_whitelist(self):
     whitelist = cvmfs.Whitelist(self.expired_whitelist)
     self.assertTrue(whitelist.expired())
Esempio n. 4
0
 def test_doesnt_contain_certificate(self):
     with open(self.certificate_file) as cert:
         whitelist = cvmfs.Whitelist(
             self.insane_whitelist_signature_mismatch)
         certificate = cvmfs.Certificate(cert)
         self.assertFalse(whitelist.contains(certificate))
Esempio n. 5
0
 def test_contains_certificate(self):
     with open(self.certificate_file) as cert:
         whitelist = cvmfs.Whitelist(self.sane_whitelist)
         certificate = cvmfs.Certificate(cert)
         self.assertTrue(whitelist.contains(certificate))
Esempio n. 6
0
 def test_verify_malformed_signature(self):
     whitelist = cvmfs.Whitelist(self.insane_whitelist_broken_signature)
     signature_valid = whitelist.verify_signature(self.public_key_file)
     self.assertFalse(signature_valid)
Esempio n. 7
0
 def test_verify_mismatching_signature(self):
     whitelist = cvmfs.Whitelist(self.insane_whitelist_signature_mismatch)
     signature_valid = whitelist.verify_signature(self.public_key_file)
     self.assertFalse(signature_valid)
Esempio n. 8
0
 def test_verify_signature(self):
     whitelist = cvmfs.Whitelist(self.sane_whitelist)
     signature_valid = whitelist.verify_signature(self.public_key_file)
     self.assertTrue(signature_valid)