twisted / twisted/twisted

Ridiculous code in ssl endpoint unit tests for ca certs dir

Open
#5,754 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core enhancement new priority-normal tests
Dominant language
Python
Stars
6k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
10

Description

exarkun's avatar @exarkun reported
Trac ID trac#5754
Type enhancement
Created 2012-07-09 00:35:40Z

twisted/internet/test/test_endpoints.py, SSLClientStringTests, contains this awesome stanza:

        expectedCerts = [
            Certificate.loadPEM(x.getContent()) for x in
                [casPath.child("thing1.pem"), casPath.child("thing2.pem")]
            if x.basename().lower().endswith('.pem')
        ]

Determining the circumstances under which that code produces different results than:

        expectedCerts = [
            Certificate.loadPEM(casPath.child(x).getContent())
            for x in ["thing1.pem", "thing2.pem"]]

is left as an exercise for the reader.

Searchable metadata
trac-id__5754 5754
type__enhancement enhancement
reporter__exarkun exarkun
priority__normal normal
milestone__ 
branch__ 
branch_author__ 
status__new new
resolution__None None
component__core core
keywords__endpoints_tests endpoints tests
time__1341794140000000 1341794140000000
changetime__1365608783000000 1365608783000000
version__None None
owner__ 
cc__thijs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in twisted/internet/test/test_endpoints.py, in SSLClientStringTests, and compare the expectedCerts setup with the simpler form shown in the issue. Run the endpoint tests and confirm they still validate the same CA certificates without the unnecessary path filtering.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.