summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfwood <john.wood@rackspace.com>2013-11-26 15:04:35 -0600
committerjfwood <john.wood@rackspace.com>2013-11-26 15:04:35 -0600
commit537ca7b06eeae6a303d5677549460edc8f2b16b4 (patch)
treeaf4660130d889be976d065989675b041034a9d7c
parent0abd5190f6e9d55163fdf8a6d83c0f106aea9cf3 (diff)
downloadpython-barbicanclient-537ca7b06eeae6a303d5677549460edc8f2b16b4.tar.gz
Add mods per peer review; Added new testing log files to gitignore file;
-rw-r--r--.gitignore2
-rw-r--r--barbicanclient/base.py10
-rw-r--r--barbicanclient/test/test_client.py22
3 files changed, 12 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 00f981f..db9daae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,8 @@ pip-log.txt
.coverage
.tox
nosetests.xml
+coverage.xml
+flake8.log
# pyenv
.python-version
diff --git a/barbicanclient/base.py b/barbicanclient/base.py
index 0736e5f..5e63f88 100644
--- a/barbicanclient/base.py
+++ b/barbicanclient/base.py
@@ -26,3 +26,13 @@ class BaseEntityManager(object):
for k in dictionary.keys():
if dictionary[k] is None:
dictionary.pop(k)
+
+ def total(self):
+ """
+ Returns the total number of entities stored in Barbican.
+ """
+ href = '{0}/{1}'.format(self.api.base_url, self.entity)
+ params = {'limit': 0, 'offset': 0}
+ resp = self.api.get(href, params)
+
+ return resp['total']
diff --git a/barbicanclient/test/test_client.py b/barbicanclient/test/test_client.py
index 2b42b02..8905264 100644
--- a/barbicanclient/test/test_client.py
+++ b/barbicanclient/test/test_client.py
@@ -46,28 +46,6 @@ class FakeResp(object):
return self.content
-class SecretData(object):
- def __init__(self):
- self.name = 'Self destruction sequence'
- self.payload = 'the magic words are squeamish ossifrage'
- self.payload_content_type = 'text/plain'
- self.content = 'text/plain'
- self.algorithm = 'AES'
- self.created = str(timeutils.utcnow())
-
- self.secret_dict = {'name': self.name,
- 'status': 'ACTIVE',
- 'algorithm': self.algorithm,
- 'created': self.created}
-
- def get_dict(self, secret_ref, content_types_dict=None):
- secret_dict = self.secret_dict
- secret_dict['secret_ref'] = secret_ref
- if content_types_dict:
- secret_dict['content_types'] = content_types_dict
- return secret_dict
-
-
class WhenTestingClientInit(unittest.TestCase):
def setUp(self):
self.auth_endpoint = 'https://localhost:5000/v2.0/'