py3: Replace unicode with six.text_type

Run the unicode operation of the sixer tool on openstack_dashboard/
directory.

tox.ini: Add the following tests to Python 3.4:

* openstack_dashboard.contrib.sahara.content.data_processing.data_sources.tests
* openstack_dashboard.contrib.sahara.content.data_processing.job_binaries.tests
* openstack_dashboard.contrib.sahara.content.data_processing.jobs.tests
* openstack_dashboard.dashboards.project.networks.tests

Partial-Implements: blueprint porting-python3
Change-Id: Ibfe52ccbccc30e6b1d59137c68942c9860805397
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
This commit is contained in:
Victor Stinner
2015-10-06 15:22:19 +02:00
parent 71b4569a69
commit 1f29e5cd67
6 changed files with 23 additions and 22 deletions

View File

@@ -106,10 +106,10 @@ class DataProcessingDataSourceTests(test.TestCase):
'description': data_source.description
}
api.sahara.data_source_get(IsA(http.HttpRequest),
IsA(unicode)) \
IsA(six.text_type)) \
.AndReturn(self.data_sources.first())
api.sahara.data_source_update(IsA(http.HttpRequest),
IsA(unicode),
IsA(six.text_type),
api_data) \
.AndReturn(self.data_sources.first())
self.mox.ReplayAll()

View File

@@ -103,7 +103,7 @@ class DataProcessingJobBinaryTests(test.TestCase):
@test.create_stubs({api.sahara: ('job_binary_get',
'job_binary_update')})
def test_update(self):
jb = api.sahara.job_binary_get(IsA(http.HttpRequest), IsA(unicode)) \
jb = api.sahara.job_binary_get(IsA(http.HttpRequest), IsA(six.text_type)) \
.AndReturn(self.job_binaries.first())
api.sahara.job_binary_update(IsA(http.HttpRequest),
IsA(str),

View File

@@ -156,7 +156,7 @@ class DataProcessingJobTests(test.TestCase):
cluster = self.clusters.first()
input_ds = self.data_sources.first()
output_ds = self.data_sources.first()
api.sahara.job_get(IsA(http.HttpRequest), IsA(unicode)) \
api.sahara.job_get(IsA(http.HttpRequest), IsA(six.text_type)) \
.AndReturn(job)
api.sahara.job_get_configs(IsA(http.HttpRequest), job.type) \
.AndReturn(job)
@@ -166,13 +166,13 @@ class DataProcessingJobTests(test.TestCase):
.MultipleTimes().AndReturn(self.data_sources.list())
api.sahara.job_list(IsA(http.HttpRequest)) \
.AndReturn(self.jobs.list())
api.sahara.job_get(IsA(http.HttpRequest), IsA(unicode)) \
api.sahara.job_get(IsA(http.HttpRequest), IsA(six.text_type)) \
.AndReturn(job)
api.sahara.job_execution_create(IsA(http.HttpRequest),
IsA(unicode),
IsA(unicode),
IsA(unicode),
IsA(unicode),
IsA(six.text_type),
IsA(six.text_type),
IsA(six.text_type),
IsA(six.text_type),
IsA(dict),
IsA(dict)).AndReturn(job_execution)
self.mox.ReplayAll()

View File

@@ -24,6 +24,8 @@ from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
import six
from horizon import exceptions
from horizon import forms as horizon_forms
from horizon import tables as horizon_tables
@@ -54,7 +56,8 @@ class IndexView(horizon_tables.DataTableView):
flavors = []
msg = _('Unable to retrieve database size information.')
exceptions.handle(self.request, msg)
return OrderedDict((unicode(flavor.id), flavor) for flavor in flavors)
return OrderedDict((six.text_type(flavor.id), flavor)
for flavor in flavors)
def _extra_data(self, cluster):
try: