Commit 450b5822 authored by Jérome Perrin's avatar Jérome Perrin

software/*/test: stop using httplib for easier python3 transition

parent 493b9949
...@@ -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]
) )
...@@ -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(),
{ {
......
...@@ -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]
) )
......
...@@ -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]
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment