Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
caucase
Commits
d51a33e8
Commit
d51a33e8
authored
Jun 26, 2020
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caucase.test: Fix testWSGI on python3.
wsgi.input is specified to be a bytes object, not a string object.
parent
f3e938ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
caucase/test.py
caucase/test.py
+10
-10
No files found.
caucase/test.py
View file @
d51a33e8
...
...
@@ -1860,7 +1860,7 @@ class CaucaseTest(unittest.TestCase):
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/csr'
,
'REQUEST_METHOD'
:
'PUT'
,
'wsgi.input'
:
String
IO
(),
'wsgi.input'
:
Bytes
IO
(),
})[
0
],
500
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/csr'
,
...
...
@@ -1897,50 +1897,50 @@ class CaucaseTest(unittest.TestCase):
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'application/json'
,
'CONTENT_LENGTH'
:
'a'
,
'wsgi.input'
:
String
IO
(),
'wsgi.input'
:
Bytes
IO
(),
})[
0
],
400
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/renew'
,
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'application/json'
,
'CONTENT_LENGTH'
:
str
(
wsgi
.
MAX_BODY_LENGTH
+
1
),
'wsgi.input'
:
String
IO
(),
'wsgi.input'
:
Bytes
IO
(),
})[
0
],
413
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/renew'
,
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'application/json'
,
'wsgi.input'
:
StringIO
(
u
'{'
),
'wsgi.input'
:
BytesIO
(
b
'{'
),
})[
0
],
400
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/revoke'
,
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'application/json'
,
'wsgi.input'
:
StringIO
(
u
'{"digest": null}'
),
'wsgi.input'
:
BytesIO
(
b
'{"digest": null}'
),
})[
0
],
UNAUTHORISED_STATUS
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/revoke'
,
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'application/json'
,
'wsgi.input'
:
StringIO
(
u
'{"digest":"sha256","payload":""}'
),
'wsgi.input'
:
BytesIO
(
b
'{"digest":"sha256","payload":""}'
),
})[
0
],
400
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/a'
,
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'text/plain'
,
'wsgi.input'
:
StringIO
(
u
''
),
'wsgi.input'
:
BytesIO
(
b
''
),
})[
0
],
400
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/123'
,
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'text/plain'
,
'wsgi.input'
:
StringIO
(
u
''
),
'wsgi.input'
:
BytesIO
(
b
''
),
})[
0
],
UNAUTHORISED_STATUS
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/123'
,
'REQUEST_METHOD'
:
'PUT'
,
'CONTENT_TYPE'
:
'text/plain'
,
'wsgi.input'
:
StringIO
(
u
'foo'
),
'wsgi.input'
:
BytesIO
(
b
'foo'
),
})[
0
],
400
)
self
.
assertEqual
(
request
({
'PATH_INFO'
:
'/cau/crt/123'
,
...
...
@@ -2125,7 +2125,7 @@ class CaucaseTest(unittest.TestCase):
'PATH_INFO'
:
'/cors'
,
'REQUEST_METHOD'
:
'POST'
,
'CONTENT_TYPE'
:
'application/x-www-form-urlencoded'
,
'wsgi.input'
:
StringIO
(
utils
.
toUnicode
(
urlencode
(
input_dict
)
)),
'wsgi.input'
:
BytesIO
(
urlencode
(
input_dict
).
encode
(
'ascii'
)),
}
base_request_reader_dict
.
update
(
kw
)
return
base_request_reader_dict
...
...
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