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

Proof that certificates allow to select given content.

parent 5e167391
...@@ -436,6 +436,27 @@ class OnlineTest(OnlineMixin, unittest.TestCase): ...@@ -436,6 +436,27 @@ class OnlineTest(OnlineMixin, unittest.TestCase):
result = signed_nc.select(key) result = signed_nc.select(key)
self.assertEqual(result.read(), self.test_string) self.assertEqual(result.read(), self.test_string)
def test_select_signed_content_multiple(self):
key = 'somekey' + str(random.random())
urlmd5 = str(random.random())
file_name = 'my file'
test_data = tempfile.TemporaryFile()
test_string = str(random.random())
test_data.write(test_string)
test_data.seek(0)
key_file = tempfile.NamedTemporaryFile()
key_file.write(self.key)
key_file.flush()
key_file.seek(0)
signed_nc = slapos.libnetworkcache.NetworkcacheClient(
self.shacache, self.shadir, key_file.name, [self.certificate])
signed_nc.upload(self.test_data, key, urlmd5=urlmd5, file_name=file_name)
signed_nc.upload(self.test_data, key, urlmd5=urlmd5, file_name=file_name)
result = signed_nc.select(key)
self.assertEqual(result.read(), self.test_string)
def test_upload_signed_content_openssl_not_available(self): def test_upload_signed_content_openssl_not_available(self):
key = 'somekey' + str(random.random()) key = 'somekey' + str(random.random())
urlmd5 = str(random.random()) urlmd5 = str(random.random())
......
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