Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Boxiang Sun
slapos
Commits
450b5822
Commit
450b5822
authored
Aug 29, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/*/test: stop using httplib for easier python3 transition
parent
493b9949
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
13 deletions
+10
-13
software/backupserver/test/test.py
software/backupserver/test/test.py
+2
-3
software/caucase/test/test.py
software/caucase/test/test.py
+2
-2
software/htmlvalidatorserver/test/test.py
software/htmlvalidatorserver/test/test.py
+2
-3
software/jstestnode/test/test.py
software/jstestnode/test/test.py
+4
-5
No files found.
software/backupserver/test/test.py
View file @
450b5822
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
##############################################################################
##############################################################################
import
httplib
import
json
import
json
import
os
import
os
import
requests
import
requests
...
@@ -54,7 +53,7 @@ class TestBackupServer(InstanceTestCase):
...
@@ -54,7 +53,7 @@ class TestBackupServer(InstanceTestCase):
# XXX crontab not triggered yet
# XXX crontab not triggered yet
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
NOT_FOUND
,
False
],
[
requests
.
codes
.
not_found
,
False
],
[
result
.
status_code
,
result
.
is_redirect
]
[
result
.
status_code
,
result
.
is_redirect
]
)
)
...
@@ -65,6 +64,6 @@ class TestBackupServer(InstanceTestCase):
...
@@ -65,6 +64,6 @@ class TestBackupServer(InstanceTestCase):
result
=
requests
.
get
(
result
=
requests
.
get
(
parameter_dict
[
'monitor-base-url'
],
verify
=
False
,
allow_redirects
=
False
)
parameter_dict
[
'monitor-base-url'
],
verify
=
False
,
allow_redirects
=
False
)
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
UNAUTHORIZED
,
False
],
[
requests
.
codes
.
unauthorized
,
False
],
[
result
.
status_code
,
result
.
is_redirect
]
[
result
.
status_code
,
result
.
is_redirect
]
)
)
software/caucase/test/test.py
View file @
450b5822
...
@@ -29,7 +29,7 @@ from __future__ import unicode_literals
...
@@ -29,7 +29,7 @@ from __future__ import unicode_literals
import
json
import
json
import
os
import
os
import
requests
import
requests
import
httplib
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
...
@@ -51,7 +51,7 @@ class TestCaucase(SlapOSInstanceTestCase):
...
@@ -51,7 +51,7 @@ class TestCaucase(SlapOSInstanceTestCase):
)
)
result
=
requests
.
get
(
connection_parameter_dict
[
'url'
])
result
=
requests
.
get
(
connection_parameter_dict
[
'url'
])
self
.
assertEqual
(
result
.
status_code
,
httplib
.
OK
)
self
.
assertEqual
(
result
.
status_code
,
requests
.
codes
.
ok
)
self
.
assertEqual
(
self
.
assertEqual
(
result
.
json
(),
result
.
json
(),
{
{
...
...
software/htmlvalidatorserver/test/test.py
View file @
450b5822
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
##############################################################################
##############################################################################
import
httplib
import
json
import
json
import
os
import
os
import
requests
import
requests
...
@@ -53,7 +52,7 @@ class TestHtmlValidatorServer(InstanceTestCase):
...
@@ -53,7 +52,7 @@ class TestHtmlValidatorServer(InstanceTestCase):
parameter_dict
[
'vnu-url'
],
verify
=
False
,
allow_redirects
=
False
)
parameter_dict
[
'vnu-url'
],
verify
=
False
,
allow_redirects
=
False
)
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
OK
,
False
,
'Apache-Coyote/1.1'
],
[
requests
.
codes
.
ok
,
False
,
'Apache-Coyote/1.1'
],
[
result
.
status_code
,
result
.
is_redirect
,
result
.
headers
[
'Server'
]]
[
result
.
status_code
,
result
.
is_redirect
,
result
.
headers
[
'Server'
]]
)
)
...
@@ -64,7 +63,7 @@ class TestHtmlValidatorServer(InstanceTestCase):
...
@@ -64,7 +63,7 @@ class TestHtmlValidatorServer(InstanceTestCase):
result
=
requests
.
get
(
result
=
requests
.
get
(
parameter_dict
[
'monitor-base-url'
],
verify
=
False
,
allow_redirects
=
False
)
parameter_dict
[
'monitor-base-url'
],
verify
=
False
,
allow_redirects
=
False
)
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
UNAUTHORIZED
,
False
],
[
requests
.
codes
.
unauthorized
,
False
],
[
result
.
status_code
,
result
.
is_redirect
]
[
result
.
status_code
,
result
.
is_redirect
]
)
)
...
...
software/jstestnode/test/test.py
View file @
450b5822
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
##############################################################################
##############################################################################
import
httplib
import
json
import
json
import
os
import
os
import
requests
import
requests
...
@@ -59,7 +58,7 @@ class TestJSTestNode(InstanceTestCase):
...
@@ -59,7 +58,7 @@ class TestJSTestNode(InstanceTestCase):
result
=
requests
.
get
(
result
=
requests
.
get
(
'%sjio/test/tests.html'
%
(
connection_dict
[
'nginx'
],
),
allow_redirects
=
False
)
'%sjio/test/tests.html'
%
(
connection_dict
[
'nginx'
],
),
allow_redirects
=
False
)
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
OK
,
False
],
[
requests
.
codes
.
ok
,
False
],
[
result
.
status_code
,
result
.
is_redirect
]
[
result
.
status_code
,
result
.
is_redirect
]
)
)
...
@@ -67,7 +66,7 @@ class TestJSTestNode(InstanceTestCase):
...
@@ -67,7 +66,7 @@ class TestJSTestNode(InstanceTestCase):
result
=
requests
.
get
(
result
=
requests
.
get
(
'%srenderjs/test/'
%
(
connection_dict
[
'nginx'
],
),
allow_redirects
=
False
)
'%srenderjs/test/'
%
(
connection_dict
[
'nginx'
],
),
allow_redirects
=
False
)
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
OK
,
False
],
[
requests
.
codes
.
ok
,
False
],
[
result
.
status_code
,
result
.
is_redirect
]
[
result
.
status_code
,
result
.
is_redirect
]
)
)
...
@@ -75,7 +74,7 @@ class TestJSTestNode(InstanceTestCase):
...
@@ -75,7 +74,7 @@ class TestJSTestNode(InstanceTestCase):
result
=
requests
.
get
(
result
=
requests
.
get
(
'%srsvp/test/index.html'
%
(
connection_dict
[
'nginx'
],
),
allow_redirects
=
False
)
'%srsvp/test/index.html'
%
(
connection_dict
[
'nginx'
],
),
allow_redirects
=
False
)
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
OK
,
False
],
[
requests
.
codes
.
ok
,
False
],
[
result
.
status_code
,
result
.
is_redirect
]
[
result
.
status_code
,
result
.
is_redirect
]
)
)
...
@@ -83,6 +82,6 @@ class TestJSTestNode(InstanceTestCase):
...
@@ -83,6 +82,6 @@ class TestJSTestNode(InstanceTestCase):
result
=
requests
.
get
(
result
=
requests
.
get
(
'http://[%s]:9443'
%
(
self
.
_ipv6_address
,
),
allow_redirects
=
False
)
'http://[%s]:9443'
%
(
self
.
_ipv6_address
,
),
allow_redirects
=
False
)
self
.
assertEqual
(
self
.
assertEqual
(
[
httplib
.
FORBIDDEN
,
False
],
[
requests
.
codes
.
forbidden
,
False
],
[
result
.
status_code
,
result
.
is_redirect
]
[
result
.
status_code
,
result
.
is_redirect
]
)
)
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