Commit c4dec598 authored by Łukasz Nowak's avatar Łukasz Nowak

Avoid importing slapos.libnetworkcache.

Instead use provided system level tools to generate keys.
parent 8ca41f42
......@@ -247,7 +247,14 @@ Now lets clean up buildout directory:
Creating the signature files:
>>> signature_data = tmpdir('signature_data')
>>> public_certificate_path, private_key_path = create_signature_file_list(signature_data)
>>> keydir = tmpdir('keydir')
>>> public_certificate_path = os.path.join(keydir, 'public.pem')
>>> private_key_path = os.path.join(keydir, 'private.pem')
>>> ignored = system(os.path.join(sample_buildout, 'bin', 'generate-signature-key') + ' --signature-certificate-file=' + public_certificate_path + ' --signature-private-key-file=' + private_key_path)
>>> ls(keydir)
- private.pem
- public.pem
Enable signature, so it should not download any content which is not trusted :
>>> write(sample_buildout, 'buildout.cfg',
......@@ -328,7 +335,13 @@ Now lets clean up buildout directory:
>>> remove('.installed.cfg')
Now lets create new signature files:
>>> new_public_certificate_path, new_private_key_path = create_signature_file_list(signature_data, 'private2.pem', 'public2.pem')
>>> new_keydir = tmpdir('newkeydir')
>>> new_public_certificate_path = os.path.join(new_keydir, 'public2.pem')
>>> new_private_key_path = os.path.join(new_keydir, 'private2.pem')
>>> ignored = system(os.path.join(sample_buildout, 'bin', 'generate-signature-key') + ' --signature-certificate-file=' + new_public_certificate_path + ' --signature-private-key-file=' + new_private_key_path)
>>> ls(new_keydir)
- private2.pem
- public2.pem
There is a new certificate file, so it should not download the old content:
>>> write(sample_buildout, 'buildout.cfg',
......
......@@ -389,15 +389,6 @@ def buildoutSetUp(test):
register_teardown(lambda: stop_server(url, thread))
return url
def create_signature_file_list(path,
private_key_file='private.pem',
certificate_file='public.pem'):
from slapos.signature import createPrivateKeyAndCertificateFile
private_key_file = os.path.join(path, private_key_file)
certificate_file = os.path.join(path, certificate_file)
createPrivateKeyAndCertificateFile(certificate_file, private_key_file)
return certificate_file, private_key_file
def make_py(initialization=''):
"""Returns paths to new executable and to its site-packages.
"""
......@@ -462,7 +453,6 @@ def buildoutSetUp(test):
bdist_egg = bdist_egg,
start_server = start_server,
start_nc = start_nc,
create_signature_file_list = create_signature_file_list,
buildout = os.path.join(sample, 'bin', 'buildout'),
wait_until = wait_until,
make_py = make_py,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment