summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/registration/tests/test_registration.py
diff options
context:
space:
mode:
authorXiaohua Zhang <xiaohua.zhang@windriver.com>2018-11-27 10:28:41 +0000
committerXiaohua Zhang <xiaohua.zhang@windriver.com>2018-11-27 10:28:41 +0000
commit0d045c0bb7ee6e6162d2c1fc3e8031a3b067f49f (patch)
treef2e007e9d25320afaee402d0d25dae20710c5bb0 /windriver/titanium_cloud/registration/tests/test_registration.py
parent87ba0b1dc07997db90d62df3c50cbb826fb8b828 (diff)
Fix pep8 errors in multicloud plugin
Fix pep8 errors in registration moduel Change-Id: I4b1d3ef1ed397c537b7904f229c0bbc07796a97e Issue-ID: MULTICLOUD-420 Signed-off-by: Xiaohua Zhang <xiaohua.zhang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/registration/tests/test_registration.py')
-rw-r--r--windriver/titanium_cloud/registration/tests/test_registration.py69
1 files changed, 32 insertions, 37 deletions
diff --git a/windriver/titanium_cloud/registration/tests/test_registration.py b/windriver/titanium_cloud/registration/tests/test_registration.py
index 38a6beed..749fba62 100644
--- a/windriver/titanium_cloud/registration/tests/test_registration.py
+++ b/windriver/titanium_cloud/registration/tests/test_registration.py
@@ -22,7 +22,7 @@ from newton_base.tests import test_base
from newton_base.util import VimDriverUtils
MOCK_GET_TENANT_RESPONSE = {
- "projects":[
+ "projects": [
{"id": "1", "name": "project"},
{"id": "2", "name": "project2"},
]
@@ -34,8 +34,8 @@ MOCK_GET_FLAVOR_RESPONSE = {
"id": "1", "name": "micro", "vcpus": 1, "ram": "1MB",
"disk": "1G", "OS-FLV-EXT-DATA:ephemeral": False,
"swap": True, "os-flavor-access:is_public": True,
- "OS-FLV-DISABLED:disabled": True, "link": [{"href":1}]
- },
+ "OS-FLV-DISABLED:disabled": True, "link": [{"href": 1}]
+ },
{
"id": "2", "name": "mini", "vcpus": 2, "ram": "2MB",
"disk": "2G", "OS-FLV-EXT-DATA:ephemeral": True,
@@ -69,7 +69,7 @@ MOCK_GET_AZ_RESPONSE = {
{
"zoneName": "production",
"zoneState": {"available": True},
- "hosts": { "hypervisor": "kvm" }
+ "hosts": {"hypervisor": "kvm"}
},
{
"zoneName": "testing",
@@ -88,9 +88,9 @@ MOCK_GET_SNAPSHOT_RESPONSE = {
{
"id": 1, "name": "test", "metadata":
{
- "architecture": "x86", "os-distro": "clearlinux",
- "os-version": "276", "vendor": "intel", "version": 3,
- "selflink": "test", "prev-snapshot-id": "test-id"
+ "architecture": "x86", "os-distro": "clearlinux",
+ "os-version": "276", "vendor": "intel", "version": 3,
+ "selflink": "test", "prev-snapshot-id": "test-id"
}
},
{"id": 2, "name": "test2"}
@@ -117,9 +117,8 @@ TEST_REGISTER_ENDPOINT_REQUEST = {
"defaultTenant": "project1"
}
-
# HPA UT1: CPU-PINNING
-MOCK_GET_HPA_FLAVOR_LIST1_RESPONSE= {
+MOCK_GET_HPA_FLAVOR_LIST1_RESPONSE = {
"flavors": [
{
"id": "1", "name": "micro", "vcpus": 1, "ram": "1024",
@@ -170,11 +169,11 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS4_RESPONSE = {
"extra_specs": {
"aggregate_instance_extra_specs:storage": "local_image",
"capabilities:cpu_info:model": "Haswell",
- "hw:numa_nodes": "2",
- "hw:numa_cpus.0": "0,1",
- "hw:numa_cpus.1": "2,3,4,5",
- "hw:numa_mem.0": "2048",
- "hw:numa_mem.1": "2048"
+ "hw:numa_nodes": "2",
+ "hw:numa_cpus.0": "0,1",
+ "hw:numa_cpus.1": "2,3,4,5",
+ "hw:numa_mem.0": "2048",
+ "hw:numa_mem.1": "2048"
}
}
@@ -183,7 +182,7 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS5_RESPONSE = {
"extra_specs": {
"aggregate_instance_extra_specs:storage": "local_image",
"capabilities:cpu_info:model": "Haswell",
- "hw:capabilities:cpu_info:features": "avx,acpi"
+ "hw:capabilities:cpu_info:features": "avx,acpi"
}
}
@@ -192,7 +191,7 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS6_RESPONSE = {
"extra_specs": {
"aggregate_instance_extra_specs:storage": "local_image",
"capabilities:cpu_info:model": "Haswell",
- "pci_passthrough:alias": "sriov-vf-intel-8086-15b3:4"
+ "pci_passthrough:alias": "sriov-vf-intel-8086-15b3:4"
}
}
@@ -206,7 +205,6 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS7_RESPONSE = {
class TestRegistration(test_base.TestRequest):
-
def setUp(self):
super(TestRegistration, self).setUp()
self.req_to_aai_backup = restcall.req_to_aai
@@ -250,19 +248,18 @@ class TestRegistration(test_base.TestRequest):
self.assertEquals(status.HTTP_202_ACCEPTED,
response.status_code)
-# @mock.patch.object(VimDriverUtils, 'delete_vim_info')
-# def test_unregister_endpoint_successfully(
-# self, mock_delete_vim_info):
-# mock_delete_vim_info.return_value = 0
+ # @mock.patch.object(VimDriverUtils, 'delete_vim_info')
+ # def test_unregister_endpoint_successfully(
+ # self, mock_delete_vim_info):
+ # mock_delete_vim_info.return_value = 0
-# response = self.client.delete((
-# "/api/multicloud-titanium_cloud/v0/windriver-hudson-dc_RegionOne/"
-# "registry"), "{}", content_type="application/json",
-# HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
-
-# self.assertEquals(status.HTTP_202_ACCEPTED,
-# response.status_code)
+ # response = self.client.delete((
+ # "/api/multicloud-titanium_cloud/v0/windriver-hudson-dc_RegionOne/"
+ # "registry"), "{}", content_type="application/json",
+ # HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
+ # self.assertEquals(status.HTTP_202_ACCEPTED,
+ # response.status_code)
@mock.patch.object(VimDriverUtils, 'delete_vim_info')
def test_fail_unregister_endpoint(
@@ -305,7 +302,7 @@ class TestRegistration(test_base.TestRequest):
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -335,8 +332,7 @@ class TestRegistration(test_base.TestRequest):
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
-
+ response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -366,7 +362,7 @@ class TestRegistration(test_base.TestRequest):
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -396,7 +392,7 @@ class TestRegistration(test_base.TestRequest):
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -426,7 +422,7 @@ class TestRegistration(test_base.TestRequest):
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -456,7 +452,7 @@ class TestRegistration(test_base.TestRequest):
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -486,5 +482,4 @@ class TestRegistration(test_base.TestRequest):
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
-
+ response.status_code)