summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAge
* tests/commands/utils: Add encrypt to self testsRuben Pollan2017-09-26
|
* tests/commands/utils: Add tests for alot/commands/utils.pyDylan Baker2017-09-25
|
* db/message: Try to use the 'Sender' header if the 'From' header is nullDylan Baker2017-09-06
| | | | This makes drafts display correctly.
* db/message: Don't set sender to ''Dylan Baker2017-09-06
| | | | | | | If the message doesn't have a sender, try to come up with one. If the message has the draft tag we known that the user is the sender, just use the default account as the from if we can't find one another way. If it doesn't have the draft tag just set the sending to 'Unknown'.
* tests/db/message: Add some tests for the message moduleDylan Baker2017-09-06
| | | | | These are just enough to look at the bug that will be fixed in the patches that follow.
* account: Fix Address comparison to b'' and u''Dylan Baker2017-09-06
| | | | | | | | | | | This uses a try/except because comparing an address to an empty string should be a fairly uncommon event and try/except will be faster than `if '@' not in other` in the case where '@' is in other. This stops alot from crashing if there is no 'From' header in the email. Outlook generates drafts without a 'From' header. Fixes #1050
* tests/account: Add test for comparing to empty stringDylan Baker2017-09-06
|
* Merge pull request #1108 from dcbaker/wip/fix-1107Patrick Totzke2017-08-30
|\ | | | | Handle servers that treat the user segment of an address as case insensitive
| * Use new Address classDylan Baker2017-08-28
| | | | | | | | | | | | | | This just wries the new Address class into alot for use, and fixes up a few places where such fixups are needed. Fixes #1107
| * account: Add an Address classDylan Baker2017-08-28
| | | | | | | | | | This class will encapsulate the logic of comparing email addresses and the rules of handling when capitalization is allowed and when it's not.
| * tests/settings/manager: Add test for case insensitivityDylan Baker2017-08-28
| | | | | | | | This currently fails as there is not way to toggle case sensitivity
* | Merge pull request #1136 from dcbaker/submit/more-db-utils-testsDylan Baker2017-08-30
|\ \ | |/ |/| more tests + cleanups
| * tests/db/utils: Add tests for message_from_stringDylan Baker2017-08-28
| |
| * tests/db/utils: Add tests for extract_body functionDylan Baker2017-08-28
| | | | | | | | | | | | there are probably still some corners with mailcap handling (parameters like copiousoutput) that are untested, but this covers a large swath of the functionality.
| * db/utils: Don't mark signature valid if there is no key to verifyDylan Baker2017-08-23
| |
| * tests/db/utils: Add some more coverage to add_signature_headersDylan Baker2017-08-23
| | | | | | | | | | There are a couple of pieces of this function that aren't covered, including a bug. yay bugs.
* | commands/globals: Only set stdin to a pipe if there is dataDylan Baker2017-08-23
| | | | | | | | | | | | | | | | | | | | Otherwise the editor will crash. I can't figure out for the life of me to test this. I thought that I would be able to do something like detect if stdin is a tty or something else, but that doesn't seem to work. Fixes #1137
* | tests/commands/globals: Add tests for stdin handlingDylan Baker2017-08-23
| |
* | tests/commands/global: Fix testsDylan Baker2017-08-23
| | | | | | | | | | These tests were wrong they would always pass, even if the code underneath was broken. With this fix they actually work.
* | Merge pull request #1135 from dcbaker/submit/external-command-testsDylan Baker2017-08-23
|\ \ | | | | | | Submit/external command tests
| * | tests/commands/globals: Add tests for ExternalCommand when spawningDylan Baker2017-08-23
| | |
| * | tests/commands/global: Test ExternalCommand when not spawningDylan Baker2017-08-23
| |/ | | | | | | | | | | This doesn't test the spawn path, which is a little bit more complicated since it's running code in a thread instead of in the main thread.
* | alot/helper: Fix call_cmd_async polluting global environmentDylan Baker2017-08-22
| | | | | | | | | | | | | | | | | | | | An assignment `e = os.environ` creates a reference not a copy, which means that modifying one necessarily modifies the other. Using `dict.copy` creates a shallow copy (the keys and values are references, but the dicts are different objects), which means only modifications to mutable objects are shared. In the case of os.environ which only contains immutable objects like strings, bools, and numbers this isn't an issue.
* | tests/helper: Add tests for call_cmd_asyncDylan Baker2017-08-22
| |
* | tests/utilities: Add expected_failure decorator for twisted.trial testsDylan Baker2017-08-22
| | | | | | | | | | | | | | | | | | Twisted.trail.unittest doesn't provide an expectedFailure decorator, nor does it work with the one from the builtin library. Instead it relies on having a "todo" attribute set. This new utilities decorator simply sets that attribute to a string value (booleans don't work).
* | tests/helper_test.py: Add tests for helper.shortenDylan Baker2017-08-22
|/
* Merge pull request #1133 from lucc/fix/bug-1132Dylan Baker2017-08-22
|\ | | | | Fix #1132 by reverting part of fa3dd1b04567.
| * Use cStringIO.StringIO to fix #1132Lucas Hoffmann2017-08-21
| | | | | | | | | | | | | | | | | | This undoes a small subset of the changes from fa3dd1b04567c4ea03fa658c3838b569531c79f5 and thus fixes #1132. The io.BytesIO object was not able to handle the unicode header names that where returned by envelope.construct_mail, which in turn did just copy them from the envelope header.
| * Add failing test for alot.helper.email_as_string()Lucas Hoffmann2017-08-21
| | | | | | | | | | Since email_as_string uses io.BytesIO it can not handle the unicode header names that might result from a envelope.construct_mail().
* | Use a tuple to build a hash valueLucas Hoffmann2017-08-20
| | | | | | | | | | | | | | | | | | The old implementation would raise an error when the translated tag string was a unicode string (might be defined as an abbreviation in the users config). The official docs suggest this kind of implementation: https://docs.python.org/3/reference/datamodel.html#object.__hash__
* | Test hash() for TagWidget with unicode representationLucas Hoffmann2017-08-20
|/
* Merge pull request #1095 from dcbaker/submit/use-default-theme-if-no-configDylan Baker2017-08-17
|\ | | | | Load default settings even if a user config doesn't exist
| * settings: Load spec file even if config file is undefined.Dylan Baker2017-08-16
| | | | | | | | | | | | | | | | | | | | This is necessary even if the config file is None to ensure that the spec file is loaded Also mock out the setting.const module in the docs, otherwise they'll fail to generate. Fixes #1094
| * tests/settings/manager: Add tests for Null config filesDylan Baker2017-08-16
| | | | | | | | Which fail, per #1094
* | Merge pull request #1115 from pazz/fix-account-selectionDylan Baker2017-08-17
|\ \ | | | | | | Fix issue with account selection
| * | use @inlineCallbacks in tests for asynchronous methodsPatrick Totzke2017-08-16
| | | | | | | | | | | | | | | This decorates test methods that internally call a `cmd.apply()`, which represents asynchronous code that returns a `twisted.deferred`.
| * | Add tests for SendCommandLucas Hoffmann2017-08-16
| | | | | | | | | | | | | | | These test only check if get_account_by_address is called correctly. All other parts of `apply()` are left out.
| * | Add test for get_account_by_address with realnameLucas Hoffmann2017-08-16
| | |
| * | fix envelope testsPatrick Totzke2017-08-16
| |/ | | | | | | | | | | This instantiates an actual Envelope object instead of a Mock object for use in the tests for envelope commands. The tests then do not fail when they hit implicit getters of the form envelope['From'].
* | db/utils: Allow encrypted messages to be put in mixed payloads as wellDylan Baker2017-08-17
| | | | | | | | | | | | | | | | Since a multipart/mixed can contain anything that a normal message could, this should be allowed. The only case that I can think of this actually happening is if an email server takes the original message, puts it in a multipart/mixed, and then attaches it's own message, like on of the annoying "this mail scanned for viruses by <product>".
* | db/utils: Handle multipart/signed inside multipart/mixedDylan Baker2017-08-17
| | | | | | | | | | | | | | | | It is possible (and actual mail clients such as kmail do) to embed a multipart/signed within a multipart/mixed (this is briefly mentioned in the acknowledgements of RFC 3156, and is perfectly valid according to RFC 1341, which says that a multipart/mixed is exactly like a top level message, except that the header may be empty.
* | tests/db/utils: Add tests for encapsulating gpg messagesDylan Baker2017-08-17
| | | | | | | | | | | | | | It is valid to encapsulate the multipart/signed and multipart/encrypted payloads in a multipart/mixed payload. All of these tests currently fail.
* | db/utils: Don't attach invalid signature to unsigned but encrypted messagesDylan Baker2017-08-17
| | | | | | | | | | | | The logic in the comment is faulty. There are perfectly legitimate reasons to encrypt but not sign a message, some of them are fleshed out in the previous commit.
* | tests/db/utils: Add tests for message_from_fileDylan Baker2017-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class tests most of the function fairly thoroughly. There are a couple of error cases that are untested, but could be tested fairly easily with some mocking. There is one test marked as expected failure. In this case I disagree with what alot does, though there probably isn't a canonical correct behavior. Specifically, if a message is encrypted but unsigned, we generate a header that says the signature is invalid. This seems incorrect for a number of reasons. First, since there is no signature, it cannot be invalid. Second, the reasoning is that it "seems suspicious" that someone would encrypt but not sign a message. This is silly, there are plenty of people who encrypt but don't sign their messages, since signing and encrypting have two totally different purposes. Signatures verify who *wrote* the message, but encryption verifies who *reads* the message. People who need some level of deniability about who wrote the message, but not about who read it (like a political activist or whistle blower) might encrypt but not sign.
* | alot/crypto: make keys required for detached_signature_forDylan Baker2017-08-17
|/ | | | | | This function is always passed a key to sign with, and not passing one leads to the first available signing key in the keyring being selected otherwise, which is problematic if one has two signing keys.
* tests/crypto: Add note about missing testsDylan Baker2017-08-14
|
* convert from pygpgme to the python "gpg" moduleDaniel Kahn Gillmor2017-08-14
| | | | | | | | | | | | | | | This converts from the now abandoned pygpgme project for wrapping gpgme, to the upstream gpgme python bindings (which are descended from the pyme project, before they became official). Largely this change should not be user visible, but there are a couple cases where the new bindings provide slightly more detailed error messages, and alot directly presents those messages to users. This patch has been significantly revised and updated by Dylan Baker, but was originally authored by Daniel Kahn Gillmor. Fixes #1069
* tests/crypto: Fix GetKey.test_missing_keyDylan Baker2017-08-14
| | | | | | | | | | | 'z', the value currently passed to get_key isn't a valid value, so it raises GPGMEError with a code of INV_VALUE. However, if an actual email is passed a KeyNotFound exception is raised instead. The existing test is valid and should remain, since it catches a potential bug, but it doesn't test for a missing key, it tests for an invalid key. This patch renames the existing test and adds a new test to cover an actual missing key.
* tests/crypto: Add more tests for list_keysDylan Baker2017-08-14
| | | | | This adds two new tests for the list_keys function that assert that the private flag is honored.
* Merge pull request #1111 from dcbaker/submit/signcommand-testsDylan Baker2017-08-14
|\ | | | | Fix issue 1113