summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/tests
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/tests')
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py12
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py7
2 files changed, 16 insertions, 3 deletions
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
index 0ca83df62..3320a866a 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
@@ -6,6 +6,8 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import re
+
from operator import itemgetter
from bson.objectid import ObjectId
@@ -190,8 +192,13 @@ class MemDb(object):
elif k == 'trust_indicator.current':
if content.get('trust_indicator').get('current') != v:
return False
- elif not isinstance(v, dict) and content.get(k, None) != v:
- return False
+ elif not isinstance(v, dict):
+ if isinstance(v, re._pattern_type):
+ if v.match(content.get(k, None)) is None:
+ return False
+ else:
+ if content.get(k, None) != v:
+ return False
return True
def _find(self, *args):
@@ -199,7 +206,6 @@ class MemDb(object):
for content in self.contents:
if self._in(content, *args):
res.append(content)
-
return res
def find(self, *args):
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py
index cb4f1d92c..d1a19f7f0 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py
@@ -21,6 +21,8 @@ class TestPodBase(base.TestBase):
self.req_d = pod_models.PodCreateRequest('zte-1', 'virtual',
'zte pod 1', 'ci-pod')
self.req_e = pod_models.PodCreateRequest('zte-2', 'metal', 'zte pod 2')
+ self.req_f = pod_models.PodCreateRequest('Zte-1', 'virtual',
+ 'zte pod 1', 'ci-pod')
self.get_res = pod_models.Pod
self.list_res = pod_models.Pods
self.basePath = '/api/v1/pods'
@@ -58,6 +60,11 @@ class TestPodCreate(TestPodBase):
self.create_d()
return self.req_d
+ @executor.create(httplib.FORBIDDEN, message.exist_base)
+ def test_alreadyExistCaseInsensitive(self):
+ self.create(self.req_f)
+ return self.req_d
+
class TestPodGet(TestPodBase):
def setUp(self):