-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests #40
base: master
Are you sure you want to change the base?
Add tests #40
Conversation
5a068ad
to
dbc21d3
Compare
I think this is really cool. Both, the tests and the backends. I don't like Here is a test that could be added:
|
@theithec Thanks for the review. I rewrote the backend (removed admin page and added a management command to generate/upload signing keys), and I'll be rebasing this off of that and adding your test this weekend. |
c7e1613
to
4df4e04
Compare
Aside from getting this reviewed (and any changes that I'll make from that), this is done. It's got 97% overall coverage, and 99% coverage for the crypto code. The only line of crypto code that isn't tested is the second encryption failure test for the backend: def encrypt(text, addr):
encryption_result = gpg.encrypt(text, addr, **encrypt_kwargs)
if not encryption_result.ok:
raise EncryptionFailedError("Encrypting mail to %s failed: '%s'",
addr, encryption_result.status)
if smart_text(encryption_result) == "" and text != "": # <-- THIS LINE
raise EncryptionFailedError("Encrypting mail to %s failed.",
addr)
return smart_text(encryption_result) |
Rebasing on master now that #41 is merged... |
Done rebasing. |
bae0064
to
1f4c306
Compare
585429e
to
f59ff47
Compare
This PR just hit 100% coverage for all code! I did skip coverage for the following lines. They are either not mission critical (testing
def ready(self): # pragma: noqa
gpg.send_keys(keyservers, fingerprint) # pragma: nocover
except ImportError: # pragma: no cover
if body_html is not None and html_message is not None: # pragma: no cover if body_html is not None: # pragma: no cover Now that this has hit 100%, I'll stop tweaking it. So @theithec if you want to review it again, I would appreciate it. I know that @stephenmcd has a lot of stuff going on at the moment. |
Should be applied after/on top of #39. I will rebase this on top of
master
once that gets merged in.The first six commits are from #39.
TODO:
email_extras.utils.send_mail
functionsave()
anddelete()
functionsBrowsableEmailBackend
has_add_permission
onAddress
adminkey.email_addresses
property)ALWAYS_TRUST
isFalse
and add tests for that- is this even useful? Everything broke when I turned that off...Test for this added from @theithec's commentThere's only one line of crypto code that isn't tested:email_extras/backends.py:72
This PR now has 100% test coverage for django-email-extras!
Further work for future PRs:
create
,update
, anddelete
functions to the queryset on the models so queryset functions operate the same way model functions dosave()
anddelete()
functions from the models into their ownpre_save
,post_save
, andpre_delete
signal handlers and wire them up inemail_extras/apps.py
. This should allow us to use serialized fixtures in tests.