Merge "Port test_serversV21 to Python 3"

This commit is contained in:
Jenkins 2016-12-02 15:27:00 +00:00 committed by Gerrit Code Review
commit bf26d65677
2 changed files with 6 additions and 9 deletions

View File

@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import base64
import collections
import datetime
import uuid
@ -24,7 +23,9 @@ import iso8601
import mock
from mox3 import mox
from oslo_policy import policy as oslo_policy
from oslo_serialization import base64
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import timeutils
import six
from six.moves import range
@ -1837,7 +1838,7 @@ class ServersControllerRebuildInstanceTest(ControllerTest):
"imageRef": self.image_uuid,
"personality": [{
"path": "/path/to/file",
"contents": base64.b64encode("Test String"),
"contents": base64.encode_as_text("Test String"),
}]
},
}
@ -3038,7 +3039,7 @@ class ServersControllerCreateTest(test.TestCase):
self.req.body = jsonutils.dump_as_bytes(self.body)
robj = self.controller.create(self.req, body=self.body)
self.assertEqual(robj['Location'], selfhref)
self.assertEqual(encodeutils.safe_decode(robj['Location']), selfhref)
def _do_test_create_instance_above_quota(self, resource, allowed, quota,
expected_msg):
@ -3312,7 +3313,8 @@ class ServersControllerCreateTest(test.TestCase):
@mock.patch.object(compute_api.API, 'create')
def test_create_instance_invalid_personality(self, mock_create):
codec = 'utf8'
content = 'b25zLiINCg0KLVJpY2hhcmQgQ$$%QQmFjaA=='
content = encodeutils.safe_encode(
'b25zLiINCg0KLVJpY2hhcmQgQ$$%QQmFjaA==')
start_position = 19
end_position = 20
msg = 'invalid start byte'

View File

@ -7,11 +7,6 @@ nova.tests.unit.api.openstack.compute.test_security_group_default_rules.TestSecu
nova.tests.unit.api.openstack.compute.test_security_group_default_rules.TestSecurityGroupDefaultRulesV21
nova.tests.unit.api.openstack.compute.test_security_groups.SecurityGroupsOutputTestV21
nova.tests.unit.api.openstack.compute.test_security_groups.TestSecurityGroupRulesV21
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerCreateTest
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerRebuildInstanceTest
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerRebuildTestV219
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerTest
nova.tests.unit.api.openstack.compute.test_serversV21.ServersControllerTestV29
nova.tests.unit.api.openstack.compute.test_simple_tenant_usage.SimpleTenantUsageTestV21
nova.tests.unit.api.openstack.compute.test_user_data.ServersControllerCreateTest
nova.tests.unit.compute.test_compute.ComputeAPITestCase.test_create_with_base64_user_data