summaryrefslogtreecommitdiff
path: root/pycadf/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-02-03 21:56:47 +0000
committerGerrit Code Review <review@openstack.org>2014-02-03 21:56:47 +0000
commit2c3e366e8a635c1b3cbfa6f7195fc53e6e8c0025 (patch)
tree17f27b6ec32e461460516bcdb9a6d6a15f6805c9 /pycadf/tests
parent32e23772a93a17091238095e1b5fc28d61bff801 (diff)
parent777831ddff76ba043d5d60f85513911a63244086 (diff)
downloadpycadf-2c3e366e8a635c1b3cbfa6f7195fc53e6e8c0025.tar.gz
Merge "mask token values"
Diffstat (limited to 'pycadf/tests')
-rw-r--r--pycadf/tests/audit/test_api.py3
-rw-r--r--pycadf/tests/test_cadf_spec.py5
-rw-r--r--pycadf/tests/test_utils.py31
3 files changed, 35 insertions, 4 deletions
diff --git a/pycadf/tests/audit/test_api.py b/pycadf/tests/audit/test_api.py
index 774e494..10abe1c 100644
--- a/pycadf/tests/audit/test_api.py
+++ b/pycadf/tests/audit/test_api.py
@@ -85,7 +85,8 @@ class TestAuditApi(base.TestCase):
'192.168.0.1')
self.assertEqual(payload['initiator']['typeURI'],
'service/security/account/user')
- self.assertEqual(payload['initiator']['credential']['token'], 'token')
+ self.assertNotEqual(payload['initiator']['credential']['token'],
+ 'token')
self.assertEqual(payload['initiator']['credential']['identity_status'],
'Confirmed')
self.assertNotIn('reason', payload)
diff --git a/pycadf/tests/test_cadf_spec.py b/pycadf/tests/test_cadf_spec.py
index 0635cdd..fdbd60c 100644
--- a/pycadf/tests/test_cadf_spec.py
+++ b/pycadf/tests/test_cadf_spec.py
@@ -15,8 +15,6 @@
# under the License.
import time
-import testtools
-
from pycadf import attachment
from pycadf import credential
from pycadf import endpoint
@@ -30,10 +28,11 @@ from pycadf import reason
from pycadf import reporterstep
from pycadf import resource
from pycadf import tag
+from pycadf.tests import base
from pycadf import timestamp
-class TestCADFSpec(testtools.TestCase):
+class TestCADFSpec(base.TestCase):
def test_endpoint(self):
endp = endpoint.Endpoint(url='http://192.168.0.1',
name='endpoint name',
diff --git a/pycadf/tests/test_utils.py b/pycadf/tests/test_utils.py
new file mode 100644
index 0000000..8eaa22a
--- /dev/null
+++ b/pycadf/tests/test_utils.py
@@ -0,0 +1,31 @@
+#
+# Copyright 2013 OpenStack LLC
+# All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+import uuid
+
+from pycadf.tests import base
+from pycadf import utils
+
+
+class TestUtils(base.TestCase):
+ def test_mask_value(self):
+ value = str(uuid.uuid4())
+ m_percent = 0.125
+ obfuscate = utils.mask_value(value, m_percent)
+ visible = int(round(len(value) * m_percent))
+ self.assertEqual(value[:visible], obfuscate[:visible])
+ self.assertNotEqual(value[:visible + 1], obfuscate[:visible + 1])
+ self.assertEqual(value[-visible:], obfuscate[-visible:])
+ self.assertNotEqual(value[-visible - 1:], obfuscate[-visible - 1:])