diff options
author | Ruben Pollan <meskio@sindominio.net> | 2016-07-06 16:38:35 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2016-07-06 16:38:35 +0200 |
commit | aafba6d33f8af1d4967d069999b9fb0052ebcd65 (patch) | |
tree | 777a6b53c3edf0feccefe36efc6024564c416e03 /tests | |
parent | c0ae8b109a21fad1c2ff56db0768c16b78f6a5f7 (diff) |
[feat] use a config class for the protect function
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_protection.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_protection.py b/tests/test_protection.py index 59effaa..1220639 100644 --- a/tests/test_protection.py +++ b/tests/test_protection.py @@ -2,7 +2,7 @@ import unittest from email.parser import Parser from zope.interface import implementer -from memoryhole import protect, OpenPGP +from memoryhole import protect, ProtectConfig, IOpenPGP FROM = "me@domain.com" @@ -27,7 +27,8 @@ class ProtectTest(unittest.TestCase): p = Parser() msg = p.parsestr(EMAIL) encrypter = Encrypter() - encmsg = protect(msg, encrypter) + conf = ProtectConfig(openpgp=encrypter) + encmsg = protect(msg, config=conf) self.assertEqual(encmsg.get_payload(1).get_payload(), encrypter.encstr) self.assertEqual(BODY, encrypter.data[1:-1]) # remove '\n' @@ -39,14 +40,15 @@ class ProtectTest(unittest.TestCase): p = Parser() msg = p.parsestr(EMAIL) encrypter = Encrypter() - encmsg = protect(msg, encrypter, obscure=False) + conf = ProtectConfig(openpgp=encrypter, obscured_headers=[]) + encmsg = protect(msg, config=conf) self.assertEqual(encmsg['from'], FROM) self.assertEqual(encmsg['to'], TO) self.assertEqual(encmsg['subject'], SUBJECT) -@implementer(OpenPGP) +@implementer(IOpenPGP) class Encrypter(object): encstr = "this is encrypted" |