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
Labels
Merge Requests
138
Merge Requests
138
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
4be4a4bc
Commit
4be4a4bc
authored
Mar 15, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web_shadir: PY3 compatibility
parent
d8b6a25e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
13 deletions
+12
-13
bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.ShaCacheMixin.py
...TemplateItem/portal_components/test.erp5.ShaCacheMixin.py
+1
-1
bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.ShaDirMixin.py
...stTemplateItem/portal_components/test.erp5.ShaDirMixin.py
+4
-5
bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.testShaDir.py
...estTemplateItem/portal_components/test.erp5.testShaDir.py
+3
-3
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py
...eItem/portal_components/test.erp5.testShaCacheExternal.py
+1
-1
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheSecurity.py
...eItem/portal_components/test.erp5.testShaCacheSecurity.py
+1
-1
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py
...ateItem/portal_components/test.erp5.testShaDirExternal.py
+2
-2
No files found.
bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.ShaCacheMixin.py
View file @
4be4a4bc
...
...
@@ -52,5 +52,5 @@ class ShaCacheMixin(object):
}
self
.
shacache_url
=
self
.
shacache
.
absolute_url
()
self
.
tic
()
self
.
data
=
'Random Content. %s'
%
str
(
random
.
random
()).
encode
()
self
.
data
=
(
'Random Content. %s'
%
random
.
random
()).
encode
()
self
.
key
=
hashlib
.
sha512
(
self
.
data
).
hexdigest
()
bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.ShaDirMixin.py
View file @
4be4a4bc
...
...
@@ -44,10 +44,9 @@ class ShaDirMixin(object):
Initialize the ERP5 site.
"""
self
.
login
()
self
.
portal
=
self
.
getPortal
()
self
.
key
=
'mykey'
+
str
(
random
.
random
())
self
.
file_content
=
'This is the content.'
self
.
file_content
=
b
'This is the content.'
self
.
file_sha512sum
=
hashlib
.
sha512
(
self
.
file_content
).
hexdigest
()
self
.
distribution
=
'pypi'
self
.
creation_date
=
DateTime
()
...
...
@@ -62,14 +61,14 @@ class ShaDirMixin(object):
'expiration_date'
:
str
(
self
.
expiration_date
),
'distribution'
:
self
.
distribution
,
'architecture'
:
self
.
architecture
}),
b64encode
(
"User SIGNATURE goes here."
)]
b64encode
(
b"User SIGNATURE goes here."
).
decode
(
)]
self
.
data
=
json
.
dumps
(
self
.
data_list
)
self
.
data
=
json
.
dumps
(
self
.
data_list
)
.
encode
()
self
.
sha512sum
=
hashlib
.
sha512
(
self
.
data
).
hexdigest
()
self
.
header_dict
=
{
'Content-Type'
:
'application/json'
,
'Authorization'
:
'Basic '
+
b64encode
(
'ERP5TypeTestCase:'
),
'Authorization'
:
'Basic '
+
b64encode
(
b'ERP5TypeTestCase:'
).
decode
(
),
}
module
=
self
.
portal
.
web_site_module
...
...
bt5/erp5_web_shadir/TestTemplateItem/portal_components/test.erp5.testShaDir.py
View file @
4be4a4bc
...
...
@@ -63,7 +63,7 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
finally
:
connection
.
close
()
self
.
assertEqual
(
result
.
status
,
six
.
moves
.
http_client
.
CREATED
)
self
.
assertEqual
(
data
,
''
)
self
.
assertEqual
(
data
,
b
''
)
def
getInformation
(
self
,
key
=
None
):
"""
...
...
@@ -215,7 +215,7 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
self
.
postInformation
()
self
.
tic
()
sha512_2
=
hashlib
.
sha512
(
str
(
random
.
random
())).
hexdigest
()
sha512_2
=
hashlib
.
sha512
(
str
(
random
.
random
())
.
encode
()
).
hexdigest
()
key_2
=
'another_key'
+
str
(
random
.
random
())
data_list_2
=
[
json
.
dumps
({
'sha512'
:
sha512_2
,
...
...
@@ -223,7 +223,7 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
'expiration_date'
:
str
(
self
.
expiration_date
),
'distribution'
:
self
.
distribution
,
'architecture'
:
self
.
architecture
}),
b64encode
(
"User SIGNATURE goes here."
)]
b64encode
(
b"User SIGNATURE goes here."
).
decode
(
)]
data_2
=
json
.
dumps
(
data_list_2
)
self
.
postInformation
(
key_2
,
data_2
)
self
.
tic
()
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py
View file @
4be4a4bc
...
...
@@ -82,7 +82,7 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase):
data
=
result
.
read
()
finally
:
connection
.
close
()
self
.
assertEqual
(
self
.
key
,
data
)
self
.
assertEqual
(
self
.
key
,
data
.
decode
()
)
self
.
assertEqual
(
six
.
moves
.
http_client
.
CREATED
,
result
.
status
)
# Check Document
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheSecurity.py
View file @
4be4a4bc
...
...
@@ -202,7 +202,7 @@ class TestShaCacheSecurity(ShaCacheMixin, ShaSecurityMixin, SecurityTestCase):
contribution_tool
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
filename
=
'test.txt'
,
data
=
'test content'
,
data
=
b
'test content'
,
reference
=
'test-reference'
)
document
()
document
.
view
()
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py
View file @
4be4a4bc
...
...
@@ -83,7 +83,7 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
data
=
result
.
read
()
finally
:
connection
.
close
()
self
.
assertEqual
(
''
,
data
)
self
.
assertEqual
(
b
''
,
data
)
self
.
assertEqual
(
201
,
result
.
status
)
# Check Data Set
...
...
@@ -121,7 +121,7 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
data
=
result
.
read
()
finally
:
connection
.
close
()
self
.
assertEqual
(
json
.
dumps
([
json
.
loads
(
self
.
data
)]),
data
)
self
.
assertEqual
(
json
.
dumps
([
json
.
loads
(
self
.
data
)]),
data
.
decode
()
)
self
.
assertEqual
(
200
,
result
.
status
)
self
.
assertEqual
(
self
.
content_type
,
result
.
getheader
(
"content-type"
))
...
...
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