Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
isaak yansane-sisk
slapos.buildout
Commits
baf23e79
Commit
baf23e79
authored
Aug 02, 2011
by
Lucas Carvalho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for the previous:
d603986d
.
parent
d603986d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletion
+49
-1
src/zc/buildout/networkcache.txt
src/zc/buildout/networkcache.txt
+18
-0
src/zc/buildout/testing.py
src/zc/buildout/testing.py
+31
-1
No files found.
src/zc/buildout/networkcache.txt
View file @
baf23e79
...
...
@@ -425,3 +425,21 @@ Buildout can download the content using the new certificate, because it still av
Got demoneeded 1.2c1.
<BLANKLINE>
###############
# PARSING URL #
###############
Check if the parsing url method works correctly, in low-level:
>>> get_filename_from_url("http://localhost/lib/patch/?id=700c7d5382b01f94e7141")
'patch'
Check if the networkcache upload method is using the correct method to
parse the original url and get the file name:
>>> tmp_dir = tmpdir('tmp_dir')
>>> write(tmp_dir, 'tmp_file', 'Content of temp file.')
>>> get_filename_from_upload_network_cached(
... dir_url=globals().get('nc_url') + 'shadir',
... cache_url=globals().get('nc_url') + 'shacache',
... external_url="http://localhost/lib/patch/?id=700c7d5382b01f94e7141",
... path=globals().get('tmp_dir') + '/tmp_file',
... nc_server_path=sample_buildout)
'patch'
src/zc/buildout/testing.py
View file @
baf23e79
...
...
@@ -37,6 +37,7 @@ import json
import
zc.buildout.buildout
import
zc.buildout.easy_install
import
zc.buildout.networkcache
from
zc.buildout.rmtree
import
rmtree
fsync
=
getattr
(
os
,
'fsync'
,
lambda
fileno
:
None
)
...
...
@@ -293,6 +294,33 @@ def make_buildout(executable=None):
# Reinstate the default values of the installer.
set_installer_values(installer_values)
def get_filename_from_upload_network_cached(**kw):
""" Check the upload network cache. """
import logging
import json
logger = logging.getLogger('zc.buildout')
nc_server_path = kw.pop('nc_server_path')
default_params = dict(logger=logger,
signature_certificate_file='',
signature_private_key_file=None)
kw.update(default_params)
zc.buildout.networkcache.upload_network_cached(**kw)
# check the file created.
external_url = kw.get('external_url')
dir_key = zc.buildout.networkcache.get_directory_key(external_url)
file_path = os.path.join(nc_server_path, 'shadir', dir_key)
f = open(file_path)
try:
data = f.read()
finally:
f.close()
data_list = json.loads(data)
property_dict = data_list[0][0]
return str(property_dict.get('file'))
def buildoutSetUp(test):
test.globs['__tear_downs'] = __tear_downs = []
...
...
@@ -437,7 +465,9 @@ def buildoutSetUp(test):
create_signature_file_list = create_signature_file_list,
buildout = os.path.join(sample, 'bin', 'buildout'),
wait_until = wait_until,
make_py = make_py
make_py = make_py,
get_filename_from_url = zc.buildout.networkcache.get_filename_from_url,
get_filename_from_upload_network_cached = get_filename_from_upload_network_cached,
))
def buildoutTearDown(test):
...
...
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