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
Ophélie Gagnard
slapos.libnetworkcache
Commits
a8b6de0e
Commit
a8b6de0e
authored
Aug 18, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do online tests against real shacache server.
parent
ab75ae2f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
slapos/libnetworkcachetests.py
slapos/libnetworkcachetests.py
+21
-3
No files found.
slapos/libnetworkcachetests.py
View file @
a8b6de0e
import
unittest
import
tempfile
import
hashlib
import
os
import
random
import
tempfile
import
unittest
from
slapos.libnetworkcache
import
NetworkcacheClient
from
slapos.signature
import
parseArgument
,
\
createPrivateKeyAndCertificateFile
...
...
@@ -29,8 +31,24 @@ class OnlineTest(unittest.TestCase):
nc
.
upload
(
content
)
def
test_download
(
self
):
# prepare some test data
test_data
=
tempfile
.
TemporaryFile
()
test_string
=
str
(
random
.
random
())
test_data
.
write
(
test_string
)
test_data
.
seek
(
0
)
shasum
=
hashlib
.
sha512
(
test_data
.
read
()).
hexdigest
()
test_data
.
seek
(
0
)
nc
=
NetworkcacheClient
(
self
.
shacache
,
self
.
shadir
)
nc
.
download
(
'sha512sum'
)
# upload them
nc
.
upload
(
test_data
)
# now try to download them
result
=
nc
.
download
(
shasum
)
# is it correctly downloaded
self
.
assertEqual
(
result
.
read
(),
test_string
)
class
LibNetworkCacheMixin
(
unittest
.
TestCase
):
...
...
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