Port config_rest_tests to Python 3
* ConfigRestTestCase: remove assertContains and assertNotContains methods, reuse assertIn and assertNotIn instead. * Fix also the HTTP body type is byte string. * tox.ini: add config_rest_tests to Python 3.4 Partial-Implements: blueprint porting-python3 Change-Id: I8cd28b4ed13ea07d77ff4c33d37162d8bf89a3a6
This commit is contained in:
parent
88983a8a65
commit
bc5d12f3d0
@ -17,22 +17,10 @@ from openstack_dashboard.test import helpers as test
|
||||
|
||||
|
||||
class ConfigRestTestCase(test.TestCase):
|
||||
def assertContains(self, response, expected_content):
|
||||
if response.find(expected_content) > 0:
|
||||
return
|
||||
self.fail('%s does not contain %s' %
|
||||
(response, expected_content))
|
||||
|
||||
def assertNotContains(self, response, expected_content):
|
||||
if response.find(expected_content) < 0:
|
||||
return
|
||||
self.fail('%s contains %s when it should not' %
|
||||
(response, expected_content))
|
||||
|
||||
def test_settings_config_get(self):
|
||||
request = self.mock_rest_request()
|
||||
response = config.Settings().get(request)
|
||||
self.assertStatusCode(response, 200)
|
||||
self.assertContains(response.content, "REST_API_SETTING_1")
|
||||
self.assertContains(response.content, "REST_API_SETTING_2")
|
||||
self.assertNotContains(response.content, "REST_API_SECURITY")
|
||||
self.assertIn(b"REST_API_SETTING_1", response.content)
|
||||
self.assertIn(b"REST_API_SETTING_2", response.content)
|
||||
self.assertNotIn(b"REST_API_SECURITY", response.content)
|
||||
|
1
tox.ini
1
tox.ini
@ -46,6 +46,7 @@ commands =
|
||||
openstack_dashboard.test.api_tests.base_tests.QuotaSetTests \
|
||||
openstack_dashboard.test.api_tests.ceilometer_tests \
|
||||
openstack_dashboard.test.api_tests.cinder_tests \
|
||||
openstack_dashboard.test.api_tests.config_rest_tests \
|
||||
openstack_dashboard.test.api_tests.fwaas_tests \
|
||||
openstack_dashboard.test.api_tests.keystone_tests \
|
||||
openstack_dashboard.test.api_tests.lbaas_tests \
|
||||
|
Loading…
Reference in New Issue
Block a user