summaryrefslogtreecommitdiffstats
path: root/pike/pike/resource/tests/test_capacity.py
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2018-12-19 15:07:21 +0800
committerHaibin Huang <haibin.huang@intel.com>2018-12-19 15:07:21 +0800
commitd76c9be3e8d91675630d8b7772051030e992bf3e (patch)
tree76e41a3126b2c885b5252c788fe8d9c4328e9618 /pike/pike/resource/tests/test_capacity.py
parent9b20c42c81cf3b1d586d04953fc95824898c4b2c (diff)
Enable pep8 check
This patch is fixing the pep8 issues under the pub and resource folder for pike release and also enable pep8 check Change-Id: I1afea756108e7bb0d79ac3f5317209fd8964f863 Issue-ID: MULTICLOUD-428 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Diffstat (limited to 'pike/pike/resource/tests/test_capacity.py')
-rw-r--r--pike/pike/resource/tests/test_capacity.py74
1 files changed, 38 insertions, 36 deletions
diff --git a/pike/pike/resource/tests/test_capacity.py b/pike/pike/resource/tests/test_capacity.py
index 23ed3275..d6f3ea32 100644
--- a/pike/pike/resource/tests/test_capacity.py
+++ b/pike/pike/resource/tests/test_capacity.py
@@ -17,30 +17,29 @@ import json
from rest_framework import status
-from common.utils import restcall
from newton_base.tests import mock_info
from newton_base.tests import test_base
from newton_base.util import VimDriverUtils
MOCK_GET_TENANT_LIMIT_RESPONSE = {
- "limits" : {
- "rate" : [],
- "absolute" : {
- "maxTotalRAMSize" : 128*1024,
- "totalRAMUsed" : 8*1024,
- "totalCoresUsed" : 4,
- "maxTotalCores" : 20,
- }
- }
+ "limits": {
+ "rate": [],
+ "absolute": {
+ "maxTotalRAMSize": 128 * 1024,
+ "totalRAMUsed": 8 * 1024,
+ "totalCoresUsed": 4,
+ "maxTotalCores": 20,
+ }
+ }
}
MOCK_GET_HYPER_STATATICS_RESPONSE = {
- "hypervisor_statistics" : {
- "vcpus_used" : 4,
- "free_ram_mb" : 120*1024,
- "vcpus" : 10,
- "free_disk_gb" : 300
- }
+ "hypervisor_statistics": {
+ "vcpus_used": 4,
+ "free_ram_mb": 120 * 1024,
+ "vcpus": 10,
+ "free_disk_gb": 300
+ }
}
MOCK_GET_STORAGE_RESPONSE_OOS = {
@@ -75,31 +74,31 @@ MOCK_GET_HYPER_STATATICS_RESPONSE_OUTOFVCPU = {
}
MOCK_GET_HYPER_STATATICS_RESPONSE_OUTOFSTORAGE = {
- "hypervisor_statistics" : {
- "vcpus_used" : 4,
- "free_ram_mb" : 120*1024,
- "vcpus" : 10,
- "free_disk_gb" : 3
- }
+ "hypervisor_statistics": {
+ "vcpus_used": 4,
+ "free_ram_mb": 120 * 1024,
+ "vcpus": 10,
+ "free_disk_gb": 3
+ }
}
MOCK_GET_HYPER_STATATICS_RESPONSE_OUTOFRAM = {
- "hypervisor_statistics" : {
- "vcpus_used" : 4,
- "free_ram_mb" : 1*1024,
- "vcpus" : 10,
- "free_disk_gb" : 300
- }
+ "hypervisor_statistics": {
+ "vcpus_used": 4,
+ "free_ram_mb": 1 * 1024,
+ "vcpus": 10,
+ "free_disk_gb": 300
+ }
}
MOCK_GET_STORAGE_RESPONSE = {
- "limits" : {
- "rate" : [],
- "absolute" : {
- "totalGigabytesUsed" : 200,
- "maxTotalVolumeGigabytes" : 500,
- }
- }
+ "limits": {
+ "rate": [],
+ "absolute": {
+ "totalGigabytesUsed": 200,
+ "maxTotalVolumeGigabytes": 500,
+ }
+ }
}
TEST_REQ_SUCCESS_SOURCE = {
@@ -114,6 +113,7 @@ TEST_REQ_FAILED_SOURCE = {
"Storage": "200"
}
+
class TestCapacity(test_base.TestRequest):
def setUp(self):
super(TestCapacity, self).setUp()
@@ -251,6 +251,9 @@ 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({"result": True}, response.data)
+
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
def test_capacity_check_volume_limits_outofstorage(self, mock_get_vim_info, mock_get_session):
@@ -272,4 +275,3 @@ class TestCapacity(test_base.TestRequest):
self.assertEquals(status.HTTP_200_OK, response.status_code)
self.assertEqual({"result": False}, response.data)
-