Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Kirill Smelkov
gevent
Commits
0a8d0bce
Commit
0a8d0bce
authored
Mar 30, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wsgi_test.py: fix TestHttps
parent
c736f972
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
27 deletions
+18
-27
greentest/wsgi_test.py
greentest/wsgi_test.py
+18
-27
No files found.
greentest/wsgi_test.py
View file @
0a8d0bce
...
...
@@ -388,42 +388,33 @@ class TestUseWrite(TestCase):
class
TestHttps
(
TestCase
):
def
setUp
(
self
):
pass
certificate_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_server.crt'
)
private_key_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_server.key'
)
sock
=
socket
.
socket
()
socket
.
bind_and_listen
(
sock
,
(
''
,
4201
))
self
.
sock
=
socket
.
ssl
(
sock
,
private_key_file
,
certificate_file
)
self
.
g
=
gevent
.
spawn
(
self
.
get_wsgi_module
().
server
,
self
.
sock
,
validator
(
self
.
application
))
def
tearDown
(
self
):
pass
self
.
g
.
kill
(
block
=
True
)
def
urlopen
(
self
,
*
args
,
**
kwargs
):
req
=
HTTPRequest
(
"https://localhost:4201/foo"
,
*
args
,
**
kwargs
)
return
urllib2
.
urlopen
(
req
)
def
application
(
self
,
environ
,
start_response
):
start_response
(
'200 OK'
,
{}
)
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)]
)
return
[
environ
[
'wsgi.input'
].
read
()]
def
test_012_ssl_server
(
self
):
certificate_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_server.crt'
)
private_key_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_server.key'
)
sock
=
socket
.
ssl_listener
((
''
,
4201
),
private_key_file
,
certificate_file
)
g
=
gevent
.
spawn
(
self
.
get_wsgi_module
().
server
,
sock
,
validator
(
self
.
application
))
try
:
req
=
HTTPRequest
(
"https://localhost:4201/foo"
,
method
=
"POST"
,
data
=
'abc'
)
f
=
urllib2
.
urlopen
(
req
)
result
=
f
.
read
()
result
=
self
.
urlopen
(
method
=
"POST"
,
data
=
'abc'
).
read
()
self
.
assertEquals
(
result
,
'abc'
)
finally
:
g
.
kill
(
block
=
True
)
def
test_013_empty_return
(
self
):
certificate_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_server.crt'
)
private_key_file
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_server.key'
)
sock
=
socket
.
ssl_listener
((
''
,
4202
),
private_key_file
,
certificate_file
)
g
=
gevent
.
spawn
(
self
.
get_wsgi_module
().
server
,
sock
,
validator
(
self
.
application
))
try
:
req
=
HTTPRequest
(
"https://localhost:4202/foo"
)
f
=
urllib2
.
urlopen
(
req
)
result
=
f
.
read
()
result
=
self
.
urlopen
().
read
()
self
.
assertEquals
(
result
,
''
)
finally
:
g
.
kill
(
block
=
True
)
class
TestInternational
(
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