Skip to content
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

Ensure load_verify_locations raises SSLError for all backends #1812

Merged
merged 3 commits into from Mar 16, 2020

Conversation

pquentin
Copy link
Member

This also adds TestSSL to the classes tested in SecureTransport and PyOpenSSL, since:

  1. TestSSL was the most natural place for this test.
  2. The test only makes sense when run against all SSL backends.

This is my take on #1517 from @pilou-: I've backported it to master, and made a few tweaks. In particular, we can't test the exact message, it's different with every backend.

Closes #1517

This also adds TestSSL to the classes tested in SecureTransport and
PyOpenSSL, since:

1. TestSSL was the most natural place for this test.
2. The test only makes sense when run against all SSL backends.

Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
@pquentin
Copy link
Member Author

@pilou- I can't assign you, but would love a review too! Thanks

Copy link
Member

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this! 🎉 Couple of questions

src/urllib3/contrib/pyopenssl.py Show resolved Hide resolved
"""
with pytest.raises(SSLError) as exc:
ssl_wrap_socket(None, ca_certs=os.devnull)
assert exc.type == SSLError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this assert redundant with the pytest.raises()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks! Fixed.

pytest.raises() already checks this.
Copy link
Member

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pquentin pquentin merged commit eee53a6 into urllib3:master Mar 16, 2020
@pquentin
Copy link
Member Author

Thanks @sethmlarson for the lint fix and the approval. Thank you @pilou- for your contribution!

@pquentin pquentin deleted the load_fail_exception branch March 23, 2020 05:41
sethmlarson added a commit to sethmlarson/urllib3 that referenced this pull request Apr 11, 2020
…3#1812)

* Ensure load_verify_locations raises SSLError for all backends

This also adds TestSSL to the classes tested in SecureTransport and
PyOpenSSL, since:

1. TestSSL was the most natural place for this test.
2. The test only makes sense when run against all SSL backends.

Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>

* Remove redundant check in test

pytest.raises() already checks this.

* Update test_socketlevel.py

Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
Dobatymo pushed a commit to Dobatymo/urllib3 that referenced this pull request Mar 16, 2022
…3#1812)

* Ensure load_verify_locations raises SSLError for all backends

This also adds TestSSL to the classes tested in SecureTransport and
PyOpenSSL, since:

1. TestSSL was the most natural place for this test.
2. The test only makes sense when run against all SSL backends.

Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>

* Remove redundant check in test

pytest.raises() already checks this.

* Update test_socketlevel.py

Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants