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
Fixed TypeError when Port of gvm.connections.SSHConnection is None #321
Conversation
Codecov Report
@@ Coverage Diff @@
## master #321 +/- ##
==========================================
+ Coverage 97.02% 97.15% +0.12%
==========================================
Files 18 18
Lines 4005 4005
==========================================
+ Hits 3886 3891 +5
+ Misses 119 114 -5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your contributions. I really appreciate that!
Passing None
and not passing a value for using a default are two different things. When I did add the typing a misunderstood the meaning of Optional
. My understanding was it is optional to pass an argument. if not passed the default will be used. But actually Optional[int]
means Union[int, None]
.
So you PR actually implemented the right meaning of Optional
but the behavior for the other parameters like hostname
is still different. Either passing None
should always use the default value or an exception should be raised here instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small thing (assertIsInstance)
What: If None is passed for any value in the constructor of SSHConnection, TLSConnection, UnixSocketConnection or GvmConnection then the default value will be used.
Why:
TypeError
will be thrown if port is None, even though Port is Optional. Closes #320How: I've added tests
Checklist: