summaryrefslogtreecommitdiff
path: root/service/test/unit/resources
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-07-16 09:55:52 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 17:00:23 +0200
commit1ee61a27b1a11f6e60dfd34fb72d3c63f05e7e24 (patch)
tree69af9525bfb06be97ab8ea0c9139b57b742b160c /service/test/unit/resources
parent6e407f47f44a641b0bb080297487f2d1a5b48c7f (diff)
Fixed unit tests.
Diffstat (limited to 'service/test/unit/resources')
-rw-r--r--service/test/unit/resources/test_keys_resources.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/service/test/unit/resources/test_keys_resources.py b/service/test/unit/resources/test_keys_resources.py
index be79424b..71a6415a 100644
--- a/service/test/unit/resources/test_keys_resources.py
+++ b/service/test/unit/resources/test_keys_resources.py
@@ -1,3 +1,5 @@
+import json
+import ast
from mockito import mock, when
from leap.keymanager import OpenPGPKey, KeyNotFound
from pixelated.resources.keys_resource import KeysResource
@@ -32,13 +34,26 @@ class TestKeysResource(unittest.TestCase):
d = self.web.get(request)
+ expected = {
+ "tags": ["keymanager-key"],
+ "fingerprint": '',
+ "private": False,
+ 'sign_used': False,
+ 'refreshed_at': 0,
+ "expiry_date": 0,
+ "address": 'some@key',
+ 'encr_used': False,
+ 'last_audited_at': 0,
+ 'key_data': '',
+ 'length': 0,
+ 'key_id': '',
+ 'validation': 'Weak_Chain',
+ 'type': 'OpenPGPKey',
+ }
+
def assert_response(_):
- self.assertEquals('"{\\"tags\\": [\\"keymanager-key\\"], \\"fingerprint\\": null, '
- '\\"private\\": null, \\"expiry_date\\": null, \\"address\\": '
- '\\"some@key\\", \\"last_audited_at\\": null, \\"key_data\\": null, '
- '\\"length\\": null, \\"key_id\\": null, \\"validation\\": null, '
- '\\"type\\": \\"<class \'leap.keymanager.openpgp.OpenPGPKey\'>\\", '
- '\\"first_seen_at\\": null}"', request.written[0])
+ actual = json.loads(ast.literal_eval(request.written[0]))
+ self.assertEquals(expected, actual)
d.addCallback(assert_response)
return d