Merge "Fix python 3 related test failures"

This commit is contained in:
Zuul 2018-03-09 17:36:31 +00:00 committed by Gerrit Code Review
commit 46ba0a8b04
4 changed files with 12 additions and 2 deletions

View File

@ -685,6 +685,8 @@ class CustomizeAction(workflows.Action):
script = upload_file.read()
if script != "":
try:
if not isinstance(script, six.text_type):
script = script.decode()
normalize_newlines(script)
except Exception as e:
msg = _('There was a problem parsing the'

View File

@ -1912,6 +1912,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
})
def test_accept_transfer(self):
transfer = self.cinder_volume_transfers.first()
self.mock_tenant_absolute_limits.return_value = \
self.cinder_limits['absolute']
formData = {'transfer_id': transfer.id, 'auth_key': transfer.auth_key}
url = reverse('horizon:project:volumes:accept_transfer')

View File

@ -20,6 +20,8 @@ import subprocess
import sys
import warnings
import six
from django.conf import settings
from django.core.management import base
from django import template
@ -112,8 +114,10 @@ for cmd in APACHE2_VERSION_CMDS:
if os.path.exists(cmd[0][0]):
try:
reg = re.compile(cmd[1])
res = reg.search(
subprocess.check_output(cmd[0], stderr=subprocess.STDOUT))
output = subprocess.check_output(cmd[0], stderr=subprocess.STDOUT)
if isinstance(output, six.binary_type):
output = output.decode()
res = reg.search(output)
if res:
APACHE2_VERSION = res.group('version')
break

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from json import loads as to_json
import uuid
from django.conf import settings
import mock
@ -319,6 +320,7 @@ class NovaRestTestCase(test.TestCase):
''')
new = nc.server_create.return_value
new.to_dict.return_value = {'name': ' Ni! '.strip()}
new.id = str(uuid.uuid4())
response = nova.Servers().post(request)
self.assertStatusCode(response, 201)
self.assertEqual({"name": "Ni!"}, response.json)