diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-07-24 16:07:25 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-07-24 16:36:12 -0700 |
commit | fa1ce885f92c805dabed31a09fe6cc513551c20b (patch) | |
tree | d0cc34b86e1c834d454b3d53bf6162e71a098d66 /tests/utilities.py | |
parent | 380be7dd329332bbb193fddb7ba2207907106ea1 (diff) |
tests: move shared helpers out of crypto module into common module
Diffstat (limited to 'tests/utilities.py')
-rw-r--r-- | tests/utilities.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/utilities.py b/tests/utilities.py index ed169b59..ac4137de 100644 --- a/tests/utilities.py +++ b/tests/utilities.py @@ -21,6 +21,9 @@ from __future__ import absolute_import import functools import unittest +import gpgme +import mock + def _tear_down_class_wrapper(original, cls): """Ensure that doClassCleanups is called after tearDownClass.""" @@ -143,3 +146,26 @@ class ModuleCleanup(object): raise return wrapper + + +def make_key(revoked=False, expired=False, invalid=False, can_encrypt=True, + can_sign=True): + mock_key = mock.create_autospec(gpgme.Key) + mock_key.uids = [mock.Mock(uid=u'mocked')] + mock_key.revoked = revoked + mock_key.expired = expired + mock_key.invalid = invalid + mock_key.can_encrypt = can_encrypt + mock_key.can_sign = can_sign + + return mock_key + + +def make_uid(email, revoked=False, invalid=False, validity=gpgme.VALIDITY_FULL): + uid = mock.Mock() + uid.email = email + uid.revoked = revoked + uid.invalid = invalid + uid.validity = validity + + return uid |