def testActivate(self):
     set_version = vault_pki._activate_version_with_rollback(
         self.versions[0],
         self.live_dir
     )
     found_version = vault_pki._get_current_version(self.live_dir)
     self.assertEqual(found_version, set_version)
Exemplo n.º 2
0
 def testActivateRollback(self):
     # first set a known good version
     set_version = vault_pki._activate_version_with_rollback(
         self.versions[0], self.live_dir)
     # then try to set a known non-existent version
     set_version = vault_pki._activate_version_with_rollback(
         self.known_missing_version, self.live_dir)
     found_version = vault_pki._get_current_version(self.live_dir)
     self.assertEqual(found_version, set_version)
Exemplo n.º 3
0
 def testActivateBrokenRollsBack(self):
     # first set a known good version
     set_version = vault_pki._activate_version_with_rollback(
         self.versions[0], self.live_dir)
     # then *break* the newer version
     new_version = vault_pki._get_version_assets(
         self.versions[1], self.fqdn, base_dir=vault_pki.BASE_DIR)
     cert, chain, key, pkcs8_key = new_version
     os.remove(cert)
     os.remove(chain)
     # attempt to activate the now broken version
     set_version = vault_pki._activate_version_with_rollback(
         self.versions[1], self.live_dir)
     found_version = vault_pki._get_current_version(self.live_dir)
     self.assertEqual(found_version, set_version)
Exemplo n.º 4
0
 def testCurrentVersionStartsEmpty(self):
     self.assertEqual(vault_pki._get_current_version(self.live_dir), None)