From fbc00166dc021898a1a7dfb98672ec3bc28851b9 Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Tue, 20 Aug 2019 10:01:12 +0000 Subject: Update windriver plugin to py3 Change-Id: I7bb1591a31de777d59ad1b96246bbc4d8e1f86f4 Issue-ID: MULTICLOUD-774 Signed-off-by: Bin Yang --- .../extensions/tests/test_extensions.py | 18 +++++------ windriver/titanium_cloud/extensions/urls.py | 4 +-- windriver/titanium_cloud/extensions/urlsV1.py | 4 +-- .../titanium_cloud/extensions/views/extensions.py | 16 +++++----- .../proxy/tests/test_service_proxy.py | 28 ++++++++--------- windriver/titanium_cloud/proxy/urls.py | 4 +-- windriver/titanium_cloud/proxy/urlsV1.py | 4 +-- .../registration/tests/test_registration.py | 20 ++++++------- .../registration/tests/test_registration2.py | 35 +++++++++++++--------- windriver/titanium_cloud/requests/urls.py | 4 +-- windriver/titanium_cloud/requests/urlsV1.py | 4 +-- .../titanium_cloud/resource/tests/test_capacity.py | 14 ++++----- windriver/titanium_cloud/samples/urls.py | 5 +++- windriver/titanium_cloud/swagger/urls.py | 4 +-- windriver/titanium_cloud/wsgi.py | 2 +- 15 files changed, 88 insertions(+), 78 deletions(-) (limited to 'windriver/titanium_cloud') diff --git a/windriver/titanium_cloud/extensions/tests/test_extensions.py b/windriver/titanium_cloud/extensions/tests/test_extensions.py index 26687b33..978e2023 100644 --- a/windriver/titanium_cloud/extensions/tests/test_extensions.py +++ b/windriver/titanium_cloud/extensions/tests/test_extensions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2018 Wind River Systems, Inc. +# Copyright (c) 2017-2019 Wind River Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import unittest from django.test import Client from rest_framework import status -import unittest class TestExtensions(unittest.TestCase): @@ -30,12 +30,12 @@ class TestExtensions(unittest.TestCase): "/api/multicloud-titaniumcloud/v0/" + vimid + "/extensions/") json_content = response.json() - self.assertEquals(status.HTTP_200_OK, response.status_code) - self.assertEquals(4, len(json_content.keys())) + self.assertEqual(status.HTTP_200_OK, response.status_code) + self.assertEqual(4, len(list(json_content.keys()))) - self.assertEquals(cloud_owner, json_content["cloud-owner"]) - self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) - self.assertEquals(vimid, json_content["vimid"]) + self.assertEqual(cloud_owner, json_content["cloud-owner"]) + self.assertEqual(cloud_region_id, json_content["cloud-region-id"]) + self.assertEqual(vimid, json_content["vimid"]) - self.assertEquals("Multiple network support", json_content["extensions"][0]["description"]) - self.assertEquals("", json_content["extensions"][0]["spec"]) + self.assertEqual("Multiple network support", json_content["extensions"][0]["description"]) + self.assertEqual("", json_content["extensions"][0]["spec"]) diff --git a/windriver/titanium_cloud/extensions/urls.py b/windriver/titanium_cloud/extensions/urls.py index 3bcf9a4c..842d8542 100644 --- a/windriver/titanium_cloud/extensions/urls.py +++ b/windriver/titanium_cloud/extensions/urls.py @@ -17,8 +17,8 @@ from rest_framework.urlpatterns import format_suffix_patterns from titanium_cloud.extensions.views import extensions -urlpatterns = [ +URLPATTERNS = [ url(r'^sions/?$', extensions.Extensions.as_view()), ] -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = format_suffix_patterns(URLPATTERNS) diff --git a/windriver/titanium_cloud/extensions/urlsV1.py b/windriver/titanium_cloud/extensions/urlsV1.py index f6398ef6..06a9e861 100644 --- a/windriver/titanium_cloud/extensions/urlsV1.py +++ b/windriver/titanium_cloud/extensions/urlsV1.py @@ -17,8 +17,8 @@ from rest_framework.urlpatterns import format_suffix_patterns from titanium_cloud.extensions.views import extensions -urlpatterns = [ +URLPATTERNS = [ url(r'^sions/?$', extensions.APIv1Extensions.as_view()), ] -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = format_suffix_patterns(URLPATTERNS) diff --git a/windriver/titanium_cloud/extensions/views/extensions.py b/windriver/titanium_cloud/extensions/views/extensions.py index 7dd78272..1bfe7417 100644 --- a/windriver/titanium_cloud/extensions/views/extensions.py +++ b/windriver/titanium_cloud/extensions/views/extensions.py @@ -25,7 +25,7 @@ from common.exceptions import VimDriverNewtonException from common.msapi import extsys from newton_base.extensions import extensions as newton_extensions -logger = logging.getLogger(__name__) +LOGGER = logging.getLogger(__name__) # DEBUG=True @@ -34,12 +34,12 @@ class Extensions(newton_extensions.Extensions): def __init__(self): super(Extensions, self).__init__() - # self._logger = logger + # self._logger = LOGGER self.proxy_prefix = settings.MULTICLOUD_PREFIX def get(self, request, vimid=""): - logger.debug("Extensions--get::data> %s" % request.data) - logger.debug("Extensions--get::vimid> %s" + LOGGER.debug("Extensions--get::data> %s" % request.data) + LOGGER.debug("Extensions--get::vimid> %s" % vimid) try: cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid) @@ -65,10 +65,10 @@ class Extensions(newton_extensions.Extensions): except VimDriverNewtonException as e: return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: - logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) + LOGGER.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) return Response(data=e.response.json(), status=e.http_status) except Exception as e: - logger.error(traceback.format_exc()) + LOGGER.error(traceback.format_exc()) return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) @@ -77,11 +77,11 @@ class APIv1Extensions(Extensions): def __init__(self): super(APIv1Extensions, self).__init__() - # self._logger = logger + # self._logger = LOGGER self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX def get(self, request, cloud_owner="", cloud_region_id=""): - self._logger.info( + LOGGER.info( "cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) diff --git a/windriver/titanium_cloud/proxy/tests/test_service_proxy.py b/windriver/titanium_cloud/proxy/tests/test_service_proxy.py index 15d46ae1..c206ba75 100644 --- a/windriver/titanium_cloud/proxy/tests/test_service_proxy.py +++ b/windriver/titanium_cloud/proxy/tests/test_service_proxy.py @@ -718,12 +718,12 @@ class TestServiceProxy(unittest.TestCase): response = self.client.head( "/api/multicloud-titaniumcloud/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) def test_unauthorized_access(self): response = self.client.get( "/api/multicloud-titaniumcloud/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers") - self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code) + self.assertEqual(status.HTTP_403_FORBIDDEN, response.status_code) @mock.patch.object(VimDriverUtils, 'get_vim_info') def test_expired_auth_token(self, mock_get_vim_info): @@ -732,7 +732,7 @@ class TestServiceProxy(unittest.TestCase): response = self.client.get( "/api/multicloud-titaniumcloud/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code) + self.assertEqual(status.HTTP_403_FORBIDDEN, response.status_code) @mock.patch.object(VimDriverUtils, 'get_token_cache') @mock.patch.object(VimDriverUtils, 'get_vim_info') @@ -744,14 +744,14 @@ class TestServiceProxy(unittest.TestCase): url_part3 = "/v2.1/fcca3cc49d5e42caae15459e27103efc/servers" url = (url_part1 + servicetype + url_part3) response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG) metadata_catalog[servicetype] = None mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog)) response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG) metadata_catalog[servicetype]['prefix'] = None @@ -759,7 +759,7 @@ class TestServiceProxy(unittest.TestCase): mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog)) response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) @mock.patch.object(VimDriverUtils, 'get_vim_info') @mock.patch.object(VimDriverUtils, 'get_session') @@ -818,29 +818,29 @@ class TestServiceProxy(unittest.TestCase): "/api/multicloud-titaniumcloud/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", MOCK_POST_SERVER_REQUEST, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code) + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) context = response.json() - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token']) self.assertIsNotNone(context['server']) # Retrieve resource response = self.client.get( "/api/multicloud-titaniumcloud/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) context = response.json() - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token']) self.assertIsNotNone(context['servers']) # Update resource response = self.client.get( "/api/multicloud-titaniumcloud/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) context = response.json() - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token']) self.assertIsNotNone(context['servers']) # simulate client to make the request @@ -848,5 +848,5 @@ class TestServiceProxy(unittest.TestCase): "/api/multicloud-titaniumcloud/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/324dfb7d-f4a9-419a-9a19-237df04b443b", HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_204_NO_CONTENT, response.status_code) - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code) + self.assertEqual(MOCK_TOKEN_ID, response['X-Subject-Token']) diff --git a/windriver/titanium_cloud/proxy/urls.py b/windriver/titanium_cloud/proxy/urls.py index 22f714d1..7b33801d 100644 --- a/windriver/titanium_cloud/proxy/urls.py +++ b/windriver/titanium_cloud/proxy/urls.py @@ -19,7 +19,7 @@ from titanium_cloud.proxy.views import identityV3 from titanium_cloud.proxy.views import services from newton_base.proxy import dnsaasdelegate -urlpatterns = [ +URLPATTERNS = [ # url(r'^identity/v2)$', # identityV2.Tokens.as_view()), url(r'^identity/v3/auth/tokens/?$', @@ -38,4 +38,4 @@ urlpatterns = [ services.Services.as_view()), ] -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = format_suffix_patterns(URLPATTERNS) diff --git a/windriver/titanium_cloud/proxy/urlsV1.py b/windriver/titanium_cloud/proxy/urlsV1.py index 757ddf7e..88a8638a 100644 --- a/windriver/titanium_cloud/proxy/urlsV1.py +++ b/windriver/titanium_cloud/proxy/urlsV1.py @@ -19,7 +19,7 @@ from titanium_cloud.proxy.views import identityV3 from titanium_cloud.proxy.views import services from newton_base.proxy import dnsaasdelegate -urlpatterns = [ +URLPATTERNS = [ url(r'^identity/v3/auth/tokens/?$', identityV3.APIv1Tokens.as_view()), url(r'^identity/v3/?$', @@ -36,4 +36,4 @@ urlpatterns = [ services.APIv1Services.as_view()), ] -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = format_suffix_patterns(URLPATTERNS) diff --git a/windriver/titanium_cloud/registration/tests/test_registration.py b/windriver/titanium_cloud/registration/tests/test_registration.py index 49df5b23..48d638d7 100644 --- a/windriver/titanium_cloud/registration/tests/test_registration.py +++ b/windriver/titanium_cloud/registration/tests/test_registration.py @@ -245,7 +245,7 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) # @mock.patch.object(VimDriverUtils, 'delete_vim_info') @@ -258,7 +258,7 @@ class TestRegistration(test_base.TestRequest): # "registry"), "{}", content_type="application/json", # HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - # self.assertEquals(status.HTTP_202_ACCEPTED, + # self.assertEqual(status.HTTP_202_ACCEPTED, # response.status_code) @mock.patch.object(VimDriverUtils, 'delete_vim_info') @@ -271,7 +271,7 @@ class TestRegistration(test_base.TestRequest): "registry"), "{}", content_type="application/json", HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_204_NO_CONTENT, + self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code) @mock.patch.object(VimDriverUtils, 'get_session') @@ -301,7 +301,7 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) @mock.patch.object(VimDriverUtils, 'get_session') @@ -331,7 +331,7 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) @mock.patch.object(VimDriverUtils, 'get_session') @@ -361,7 +361,7 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) @mock.patch.object(VimDriverUtils, 'get_session') @@ -391,7 +391,7 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) @mock.patch.object(VimDriverUtils, 'get_session') @@ -421,7 +421,7 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) @mock.patch.object(VimDriverUtils, 'get_session') @@ -451,7 +451,7 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) @mock.patch.object(VimDriverUtils, 'get_session') @@ -481,5 +481,5 @@ class TestRegistration(test_base.TestRequest): "registry"), TEST_REGISTER_ENDPOINT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_202_ACCEPTED, + self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code) diff --git a/windriver/titanium_cloud/registration/tests/test_registration2.py b/windriver/titanium_cloud/registration/tests/test_registration2.py index e00c6adc..1072b373 100644 --- a/windriver/titanium_cloud/registration/tests/test_registration2.py +++ b/windriver/titanium_cloud/registration/tests/test_registration2.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock - +# import mock import unittest +from unittest import mock + # import json from django.test import Client from rest_framework import status @@ -72,6 +73,7 @@ MOCK_GET_FLAVOR_EXTRASPECS_RESPONSE_w_hpa_numa = { } + class TestRegistration2(unittest.TestCase): def setUp(self): self.client = Client() @@ -84,25 +86,30 @@ class TestRegistration2(unittest.TestCase): restcall.req_to_aai = mock.Mock() restcall.req_to_aai.return_value = (0, {}, status.HTTP_200_OK) mock_session = test_base.get_mock_session( - ["get"], {"get": { - "content": MOCK_GET_FLAVOR_RESPONSE}}), - - retcode, content = self.view.register_helper._discover_flavors(vimid="windriver-hudson-dc_RegionOne", + ["get"], { + "side_effect": [ + test_base.get_mock_response(MOCK_GET_FLAVOR_RESPONSE) + ] + }) + retcode, content = self.view.register_helper._discover_flavors( + vimid="windriver-hudson-dc_RegionOne", session=mock_session, viminfo=MOCK_VIM_INFO) - self.assertEquals(retcode, 11) + self.assertEqual(retcode, 0) def test_discover_flavors_w_hpa_numa(self): restcall.req_to_aai = mock.Mock() restcall.req_to_aai.return_value = (0, {}, status.HTTP_200_OK) mock_session = test_base.get_mock_session( - ["get"], {"side_effect": [{ - "content": MOCK_GET_FLAVOR_RESPONSE_w_hpa_numa}, - { - "content": MOCK_GET_FLAVOR_EXTRASPECS_RESPONSE_w_hpa_numa} - ]}), + ["get"], { + "side_effect": [ + test_base.get_mock_response(MOCK_GET_FLAVOR_RESPONSE_w_hpa_numa), + test_base.get_mock_response(MOCK_GET_FLAVOR_EXTRASPECS_RESPONSE_w_hpa_numa), + ] + }) - retcode, content = self.view.register_helper._discover_flavors(vimid="windriver-hudson-dc_RegionOne", + retcode, content = self.view.register_helper._discover_flavors( + vimid="windriver-hudson-dc_RegionOne", session=mock_session, viminfo=MOCK_VIM_INFO) - self.assertEquals(retcode, 11) + self.assertEqual(retcode, 0) diff --git a/windriver/titanium_cloud/requests/urls.py b/windriver/titanium_cloud/requests/urls.py index bfba9c73..73a91f20 100644 --- a/windriver/titanium_cloud/requests/urls.py +++ b/windriver/titanium_cloud/requests/urls.py @@ -25,7 +25,7 @@ from newton_base.openoapi import limits from newton_base.openoapi import hosts from newton_base.openoapi import flavor -urlpatterns = [ +URLPATTERNS = [ url(r'^networks(/(?P[0-9a-zA-Z_-]+))?', network.Networks.as_view()), url(r'^subnets(/(?P[0-9a-zA-Z_-]+))?', @@ -50,4 +50,4 @@ urlpatterns = [ url(r'^hosts(/(?P[0-9a-zA-Z_-]+))?', hosts.Hosts.as_view()), ] -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = format_suffix_patterns(URLPATTERNS) diff --git a/windriver/titanium_cloud/requests/urlsV1.py b/windriver/titanium_cloud/requests/urlsV1.py index eaca68c6..2bd18287 100644 --- a/windriver/titanium_cloud/requests/urlsV1.py +++ b/windriver/titanium_cloud/requests/urlsV1.py @@ -25,7 +25,7 @@ from newton_base.openoapi import limits from newton_base.openoapi import hosts from newton_base.openoapi import flavor -urlpatterns = [ +URLPATTERNS = [ url(r'^networks(/(?P[0-9a-zA-Z_-]+))?', network.APIv1Networks.as_view()), url(r'^subnets(/(?P[0-9a-zA-Z_-]+))?', @@ -50,4 +50,4 @@ urlpatterns = [ url(r'^hosts(/(?P[0-9a-zA-Z_-]+))?', hosts.APIv1Hosts.as_view()), ] -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = format_suffix_patterns(URLPATTERNS) diff --git a/windriver/titanium_cloud/resource/tests/test_capacity.py b/windriver/titanium_cloud/resource/tests/test_capacity.py index 82c453a2..72fff786 100644 --- a/windriver/titanium_cloud/resource/tests/test_capacity.py +++ b/windriver/titanium_cloud/resource/tests/test_capacity.py @@ -143,7 +143,7 @@ class TestCapacity(test_base.TestRequest): TEST_REQ_SUCCESS_SOURCE, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual({'AZs': [],"result": True}, response.data) @mock.patch.object(VimDriverUtils, 'get_session') @@ -164,7 +164,7 @@ class TestCapacity(test_base.TestRequest): TEST_REQ_FAILED_SOURCE, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual({'AZs': [],"result": False}, response.data) @mock.patch.object(VimDriverUtils, 'get_session') @@ -186,7 +186,7 @@ class TestCapacity(test_base.TestRequest): content_type='application/json', HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual({'AZs': [],"result": False}, response.data) @mock.patch.object(VimDriverUtils, 'get_session') @@ -208,7 +208,7 @@ class TestCapacity(test_base.TestRequest): content_type='application/json', HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual({'AZs': [],"result": False}, response.data) @mock.patch.object(VimDriverUtils, 'get_session') @@ -230,7 +230,7 @@ class TestCapacity(test_base.TestRequest): content_type='application/json', HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual({'AZs': [],"result": False}, response.data) @mock.patch.object(VimDriverUtils, 'get_session') @@ -252,7 +252,7 @@ class TestCapacity(test_base.TestRequest): content_type='application/json', HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual({'AZs': [], "result": False}, response.data) @mock.patch.object(VimDriverUtils, 'get_session') @@ -274,5 +274,5 @@ class TestCapacity(test_base.TestRequest): content_type='application/json', HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual({'AZs': [], "result": False}, response.data) diff --git a/windriver/titanium_cloud/samples/urls.py b/windriver/titanium_cloud/samples/urls.py index e5f0e65c..71a53593 100644 --- a/windriver/titanium_cloud/samples/urls.py +++ b/windriver/titanium_cloud/samples/urls.py @@ -13,7 +13,10 @@ # limitations under the License. from django.conf.urls import url +from rest_framework.urlpatterns import format_suffix_patterns from titanium_cloud.samples import views -urlpatterns = [ +URLPATTERNS = [ url(r'^samples/?$', views.SampleList.as_view()), ] + +urlpatterns = format_suffix_patterns(URLPATTERNS) \ No newline at end of file diff --git a/windriver/titanium_cloud/swagger/urls.py b/windriver/titanium_cloud/swagger/urls.py index a690d9cf..cdd9e8ed 100644 --- a/windriver/titanium_cloud/swagger/urls.py +++ b/windriver/titanium_cloud/swagger/urls.py @@ -20,7 +20,7 @@ from titanium_cloud.swagger.views import APIv1SwaggerJsonViewDepreciated from titanium_cloud.swagger.views import SwaggerJsonView from titanium_cloud.swagger.views import APIv1SwaggerJsonView -urlpatterns = [ +URLPATTERNS = [ # API v0, depreciated url(r'^api/multicloud-titanium_cloud/v0/swagger.json$', SwaggerJsonViewDepreciated.as_view()), @@ -35,4 +35,4 @@ urlpatterns = [ ] -urlpatterns = format_suffix_patterns(urlpatterns) +urlpatterns = format_suffix_patterns(URLPATTERNS) diff --git a/windriver/titanium_cloud/wsgi.py b/windriver/titanium_cloud/wsgi.py index 14676067..975baed0 100644 --- a/windriver/titanium_cloud/wsgi.py +++ b/windriver/titanium_cloud/wsgi.py @@ -19,4 +19,4 @@ from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "titanium_cloud.settings") -application = get_wsgi_application() +APPLICATION = get_wsgi_application() -- cgit 1.2.3-korg