Corrects the type of a base64 encoded string
The nova/tests/functional/api_sample_tests/test_servers.py contains the ServersSampleBase class, and in its class definition creates a 'user_data' attribute by base64 encoding a string. However, this will not work in Python 3, as the base64.b64encode() method requires bytes, not a string. As a result, importing the test class fails and no tests get run. Note that this change doesn't fix all tests to work under Python 3; it simply fixes the bug that prevents the tests from running at all under Python 3. Closes-Bug: #1632856 Change-Id: I35a7b02132bed0387a173b339f6204bf0e3269de
This commit is contained in:
parent
14bbfc497b
commit
a2d7ebd39b
@ -16,6 +16,8 @@
|
|||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from nova.api.openstack import api_version_request as avr
|
from nova.api.openstack import api_version_request as avr
|
||||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||||
from nova.tests.unit.api.openstack import fakes
|
from nova.tests.unit.api.openstack import fakes
|
||||||
@ -26,7 +28,7 @@ class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
|
|||||||
microversion = None
|
microversion = None
|
||||||
sample_dir = 'servers'
|
sample_dir = 'servers'
|
||||||
|
|
||||||
user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n'
|
user_data_contents = six.b('#!/bin/bash\n/bin/su\necho "I am in you!"\n')
|
||||||
user_data = base64.b64encode(user_data_contents)
|
user_data = base64.b64encode(user_data_contents)
|
||||||
|
|
||||||
common_req_names = [
|
common_req_names = [
|
||||||
|
4
tox.ini
4
tox.ini
@ -47,8 +47,8 @@ commands =
|
|||||||
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
|
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
|
||||||
|
|
||||||
[testenv:functional]
|
[testenv:functional]
|
||||||
# TODO(melwitt): This can be removed when functional tests can be run
|
# TODO(melwitt): This can be removed when functional tests are gating with
|
||||||
# with python 3.x
|
# python 3.x
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
|
Loading…
Reference in New Issue
Block a user