Beispiel #1
0
def test_security_get_bytes(tmpdir):
    path = str(tmpdir)
    s1 = skein.Security.new_credentials()
    s2 = s1.to_directory(path)

    for kind in ['cert', 'key']:
        x1 = s1._get_bytes(kind)
        x2 = s2._get_bytes(kind)
        assert isinstance(x1, bytes)
        assert isinstance(x2, bytes)
        assert x1 == x2

    not_local = skein.Security(cert_file="hdfs:///some/path",
                               key_file="hdfs:///some/path")
    missing = skein.Security(cert_file="definitely/a/missing/path",
                             key_file="definitely/a/missing/path")

    for kind in ['cert', 'key']:
        with pytest.raises(ValueError):
            not_local._get_bytes(kind)

        with pytest.raises(FileNotFoundError):
            missing._get_bytes(kind)
Beispiel #2
0
 def _get_security(self, cluster):
     return skein.Security(cert_bytes=cluster.tls_cert,
                           key_bytes=cluster.tls_key)
Beispiel #3
0
 def _get_security(self):
     return skein.Security(cert_bytes=self.tls_cert, key_bytes=self.tls_key)