Commit 70ec41e1 authored by Łukasz Nowak's avatar Łukasz Nowak

Implement negative test for non existence of cache.

parent 9b7aac9a
...@@ -11,7 +11,7 @@ import tempfile ...@@ -11,7 +11,7 @@ import tempfile
import threading import threading
import time import time
import unittest import unittest
from slapos.libnetworkcache import NetworkcacheClient, UploadError from slapos.libnetworkcache import NetworkcacheClient, UploadError, DirectoryNotFound
from slapos.signature import parseArgument, \ from slapos.signature import parseArgument, \
createPrivateKeyAndCertificateFile createPrivateKeyAndCertificateFile
...@@ -207,6 +207,15 @@ class OnlineTest(OnlineMixin, unittest.TestCase): ...@@ -207,6 +207,15 @@ class OnlineTest(OnlineMixin, unittest.TestCase):
result = nc.select(key) result = nc.select(key)
self.assertEqual(result.read(), self.test_string) self.assertEqual(result.read(), self.test_string)
def test_upload_shadir_select_not_exists(self):
"""Check scenario with shadir used"""
nc = NetworkcacheClient(self.shacache, self.shadir)
urlmd5 = str(random.random())
key = 'somekey' + str(random.random())
nc.upload(self.test_data, key, urlmd5=urlmd5, file_name='my file')
self.assertRaises(DirectoryNotFound, nc.select,
'key_another_key' + str(random.random()))
def test_upload_shadir_no_filename(self): def test_upload_shadir_no_filename(self):
"""Check scenario with shadir used, but not filename passed""" """Check scenario with shadir used, but not filename passed"""
nc = NetworkcacheClient(self.shacache, self.shadir) nc = NetworkcacheClient(self.shacache, self.shadir)
......
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