Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos.libnetworkcache
Commits
cd9e5f6a
Commit
cd9e5f6a
authored
Aug 24, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Except 404 in some cases.
parent
7f8dbf51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
slapos/libnetworkcachetests.py
slapos/libnetworkcachetests.py
+12
-2
No files found.
slapos/libnetworkcachetests.py
View file @
cd9e5f6a
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment