summaryrefslogtreecommitdiffstats
path: root/ocata/ocata/resource/tests/test_capacity.py
diff options
context:
space:
mode:
Diffstat (limited to 'ocata/ocata/resource/tests/test_capacity.py')
-rw-r--r--ocata/ocata/resource/tests/test_capacity.py76
1 files changed, 39 insertions, 37 deletions
diff --git a/ocata/ocata/resource/tests/test_capacity.py b/ocata/ocata/resource/tests/test_capacity.py
index 0f1fc160..926b5a0b 100644
--- a/ocata/ocata/resource/tests/test_capacity.py
+++ b/ocata/ocata/resource/tests/test_capacity.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2018 Wind River Systems, Inc.
+# Copyright (c) 2018 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -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)
-