python bindings: fixing decrypt-verify

* lang/python/src/core.py: First restoring the exception to the being
  just that.
* The means to manipulate the error output is temporarily in commented
  out code, but ought to be added to a proper test later.
* In the mean time the original test, with a very slight change, works
  again.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
This commit is contained in:
Ben McGinnes 2018-09-30 19:32:45 +10:00
parent 11403a4635
commit 837a476053
2 changed files with 7 additions and 6 deletions

View File

@ -450,10 +450,11 @@ class Context(GpgmeWrapper):
try: try:
raise errors.MissingSignatures(verify_result, missing, raise errors.MissingSignatures(verify_result, missing,
results=results) results=results)
except errors.MissingSignatures as miss_e: except errors.MissingSignatures as e:
mse = miss_e raise e
mserr = "gpg.errors.MissingSignatures:" # mse = e
print(mserr, miss_e, "\n") # mserr = "gpg.errors.MissingSignatures:"
# print(mserr, miss_e, "\n")
# # The full details can then be found in mse.results, # # The full details can then be found in mse.results,
# # mse.result, mse.missing if necessary. # # mse.result, mse.missing if necessary.
# mse_list = [] # mse_list = []
@ -468,7 +469,7 @@ class Context(GpgmeWrapper):
# msl.append(user.email) # msl.append(user.email)
# # msl.append(user.uid) # # msl.append(user.uid)
# print(" ".join(msl)) # print(" ".join(msl))
return mse # raise mse
return results return results

View File

@ -70,7 +70,7 @@ with gpg.Context() as c:
try: try:
c.decrypt( c.decrypt(
open(support.make_filename("cipher-2.asc")), verify=[alpha, bob]) open(support.make_filename("cipher-2.asc")), verify=[alpha, bob])
except gpg.errors.MissingSignatures as e: except Exception as e:
assert len(e.missing) == 1 assert len(e.missing) == 1
assert e.missing[0] == bob assert e.missing[0] == bob
else: else: