Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
ad38c89d
Commit
ad38c89d
authored
Jul 05, 2011
by
Lucas Carvalho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated test with latest changes.
parent
f0ff55f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
bt5/erp5_web_shacache/TestTemplateItem/testShaCache.py
bt5/erp5_web_shacache/TestTemplateItem/testShaCache.py
+13
-9
bt5/erp5_web_shacache/bt/revision
bt5/erp5_web_shacache/bt/revision
+1
-1
No files found.
bt5/erp5_web_shacache/TestTemplateItem/testShaCache.py
View file @
ad38c89d
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
import
transaction
import
transaction
import
httplib
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
ShaCacheMixin
import
ShaCacheMixin
from
ShaCacheMixin
import
ShaCacheMixin
...
@@ -55,7 +56,7 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
...
@@ -55,7 +56,7 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
def
p
os
tFile
(
self
,
key
=
None
):
def
p
u
tFile
(
self
,
key
=
None
):
"""
"""
Post the file
Post the file
"""
"""
...
@@ -68,11 +69,13 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
...
@@ -68,11 +69,13 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
data_file
.
seek
(
0
)
data_file
.
seek
(
0
)
self
.
portal
.
changeSkin
(
'SHACACHE'
)
self
.
portal
.
changeSkin
(
'SHACACHE'
)
self
.
shacache
.
REQUEST
.
set
(
'method'
,
'POST'
)
path
=
self
.
shacache
.
getPath
()
self
.
shacache
.
REQUEST
.
set
(
'Content-Type'
,
'application/json'
)
response
=
self
.
publish
(
'%s/%s'
%
(
path
,
key
),
self
.
shacache
.
REQUEST
.
_file
=
data_file
request_method
=
'PUT'
,
self
.
shacache
.
WebSection_getDocumentValue
(
key
)
stdin
=
data_file
,
basic
=
'ERP5TypeTestCase:'
)
self
.
stepTic
()
self
.
stepTic
()
self
.
assertEqual
(
response
.
getStatus
(),
httplib
.
CREATED
)
finally
:
finally
:
data_file
.
close
()
data_file
.
close
()
...
@@ -88,11 +91,11 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
...
@@ -88,11 +91,11 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
self
.
shacache
.
REQUEST
.
set
(
'method'
,
'GET'
)
self
.
shacache
.
REQUEST
.
set
(
'method'
,
'GET'
)
return
self
.
shacache
.
WebSection_getDocumentValue
(
key
)
return
self
.
shacache
.
WebSection_getDocumentValue
(
key
)
def
test_p
os
t_file
(
self
):
def
test_p
u
t_file
(
self
):
"""
"""
Check if the
posted file has all the properties defined
.
Check if the
PUT method is creating an object
.
"""
"""
self
.
p
os
tFile
()
self
.
p
u
tFile
()
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
document_module
))
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
document_module
))
document
=
self
.
portal
.
document_module
.
contentValues
()[
0
]
document
=
self
.
portal
.
document_module
.
contentValues
()[
0
]
...
@@ -100,12 +103,13 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
...
@@ -100,12 +103,13 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
self
.
assertEquals
(
self
.
key
,
document
.
getReference
())
self
.
assertEquals
(
self
.
key
,
document
.
getReference
())
self
.
assertEquals
(
self
.
data
,
document
.
getData
())
self
.
assertEquals
(
self
.
data
,
document
.
getData
())
self
.
assertEquals
(
'application/octet-stream'
,
document
.
getContentType
())
self
.
assertEquals
(
'application/octet-stream'
,
document
.
getContentType
())
self
.
assertEquals
(
'Published'
,
document
.
getValidationStateTitle
())
def
test_get_file
(
self
):
def
test_get_file
(
self
):
"""
"""
Check if the file returned is the correct.
Check if the file returned is the correct.
"""
"""
self
.
test_p
os
t_file
()
self
.
test_p
u
t_file
()
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
document_module
))
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
document_module
))
document
=
self
.
getFile
()
document
=
self
.
getFile
()
...
...
bt5/erp5_web_shacache/bt/revision
View file @
ad38c89d
38
39
\ No newline at end of file
\ No newline at end of file
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