Add SSL support (SMTPS/STARTTLS) to CLI#252
Merged
pepoluan merged 28 commits intoaio-libs:masterfrom Feb 22, 2021
Merged
Conversation
Original name of "args" make it a bit difficult trying to troubleshoot.
Added 5 parameters plus validation of their combinations. Also test case for the validation logic.
Validation is simply checking they exist. Also test case
Secure by default
Whoa, we never asserted this before...
It is ignored anyways if --tlscert and --tlskey not specified.
This makes them easily importable by test suites. Also create an __all__ module attribute listing all the variables (excl. fixtures) available in conftest.py
... and their test cases.
* test_ssl_files renamed to test_ssl_files_err * Use constants for test_ssl_files_err * isort * black
When run using pytest directly, 1.0 is enough. But tox (and probably PyCharm tox runner) added enough overhead that 1.0 is barely enough, resulting in flakey test.
A bit of difference between tox & GA: * In tox, Bandit is run in "qa", because Bandit can run on Windows and if placed in "static", it will not be run, and that's a loss. * In GA, Bandig is run during "Static Code Checking" because that's more accurate.
Lines marked "# nosec" are intentional, so we suppress Bandit's complaints on those lines.
pypy3.6-7.3.1 puked on this
According to Bandit docs in https://github.com/PyCQA/bandit, we should run Bandit using the same Python version as will be used by the program. Since aiosmtpd is meant to be a cross-platform, cross-version library, we move it up there to Bandit-test with every supported version.
* Extract test_tls, test_tls_noreq, and test_smtps into a separate class to better control the event loop * Change from "naive timeout" (which sometimes result in test-flakines to Event-based continuation (more deterministic) * Schedule the autostop to as near as possible to main() call
Because the watch_for_* watchers are now much more deterministic after we change over to Event-based-continuation.
See 2c0bc26 for reasoning
PyPy3.7.9-7.3.3 still barfs here.
Codecov Report
@@ Coverage Diff @@
## master #252 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 1542 1571 +29
Branches 285 293 +8
=========================================
+ Hits 1542 1571 +29
Continue to review full report at Codecov.
|
* Some region..endregion folders
* main(("-n", ...)) calls wrapped in main_n() func
# Conflicts: # .github/workflows/unit-testing-and-coverage.yml # aiosmtpd/__init__.py # aiosmtpd/docs/NEWS.rst # aiosmtpd/tests/test_main.py
Apparently Unicode triangles is not as universal as the checkerboard pattern. Go figure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What do these changes do?
Implement support for SMTPS/STARTTLS for the CLI program.
Are there changes in behavior for the user?
None. This is a totally new feature that does not impact current users.
Related issue number
Closes #172
Checklist
(ALL)qa,py-{nocov,cov}(ALL) + static + pypy3-{nocov,cov,diffcov}(ALL) + static + pypy3-{nocov,cov,diffcov}NEWS.rstfile