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

Except 404 in some cases.

parent 7f8dbf51
...@@ -4,6 +4,7 @@ import hashlib ...@@ -4,6 +4,7 @@ import hashlib
import httplib import httplib
import json import json
import os import os
import urllib2
import random import random
import shutil import shutil
import socket import socket
...@@ -213,8 +214,10 @@ class OnlineTest(OnlineMixin, unittest.TestCase): ...@@ -213,8 +214,10 @@ class OnlineTest(OnlineMixin, unittest.TestCase):
urlmd5 = str(random.random()) urlmd5 = str(random.random())
key = 'somekey' + str(random.random()) key = 'somekey' + str(random.random())
nc.upload(self.test_data, key, urlmd5=urlmd5, file_name='my file') nc.upload(self.test_data, key, urlmd5=urlmd5, file_name='my file')
self.assertRaises(DirectoryNotFound, nc.select, try:
'key_another_key' + str(random.random())) nc.select('key_another_key' + str(random.random()))
except urllib2.HTTPError, error:
self.assertEqual(error.code, httplib.NOT_FOUND)
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"""
...@@ -243,6 +246,13 @@ class OnlineTest(OnlineMixin, unittest.TestCase): ...@@ -243,6 +246,13 @@ class OnlineTest(OnlineMixin, unittest.TestCase):
# is it correctly downloaded # is it correctly downloaded
self.assertEqual(result.read(), self.test_string) self.assertEqual(result.read(), self.test_string)
def test_download_not_exists(self):
nc = NetworkcacheClient(self.shacache, self.shadir)
try:
nc.download(self.test_shasum)
except urllib2.HTTPError, error:
self.assertEqual(error.code, httplib.NOT_FOUND)
def _run_nc_POST200(tree, host, port): def _run_nc_POST200(tree, host, port):
server_address = (host, port) server_address = (host, port)
httpd = Server(tree, server_address, NCHandlerPOST200) httpd = Server(tree, server_address, NCHandlerPOST200)
......
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