Exemple #1
0
 def test_read_manifest_file_permission_denied(self):
     with self.assertRaises(SystemExit) as e:
         utils.read_manifest_file(path='/etc/shadow')
     self.assertEqual(
         e.exception.args[0],
         "[-] pkictl - Error: failed to read manifest file, permission denied"
     )
Exemple #2
0
    def test_read_manifest_file_invalid_yaml(self):
        t = tempfile.NamedTemporaryFile()
        t.write(b"---\nx: y:\n")
        t.seek(0)

        with self.assertRaises(SystemExit) as e:
            utils.read_manifest_file(path=t.name)
        self.assertEqual(
            e.exception.args[0],
            "[-] pkictl - Error: failed to parse manifest file, invalid YAML")
Exemple #3
0
    def test_get_validated_manifests(self):
        d = utils.read_manifest_file(PKI_MANIFEST_YAML)

        roots, intermediates, kv_engines = utils.get_validated_manifests(d)

        self.assertIsInstance(roots, list)
        self.assertEqual(len(roots), 2)
        self.assertIsInstance(intermediates, list)
        self.assertEqual(len(intermediates), 3)
        self.assertIsInstance(kv_engines, list)
Exemple #4
0
 def test_read_manifest_file_nonexistant(self):
     with self.assertRaises(SystemExit) as e:
         utils.read_manifest_file(path='/manifest.yaml')
     self.assertEqual(e.exception.args[0],
                      "[-] pkictl - Error: manifest file does not exist")
Exemple #5
0
 def test_read_manifest_file(self):
     d = utils.read_manifest_file(ROOT_MANIFEST_YAML)
     self.assertIsInstance(d, list)