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
unit tests for ansible.module_utils.urls #38059
Conversation
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.
Could you submit the ansible-test changes in a separate PR?
test/runner/lib/cover.py
Outdated
if args.include: | ||
options.extend([ | ||
'--include', | ||
args.include |
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.
Style recommendation....
Since this option (and the following one) only take a single argument, it would be easier to read as:
options.extend(['--include', args.include])
Keeping the option and the arg together is also more readable with multiple options (doesn't apply in this case):
options.extend([
'--include', args.include,
'--some-other-arg', args.some_other_arg,
])
The test
|
Done. See #38061 I'll rebase this to remove the commit after the other is merged. |
The test
The test
|
@mattclay ansible-test changes removed from this PR |
fcd8836
to
05e9565
Compare
Removing WIP. I'm going with this as is for now. These tests alone cover 52% of ready_for_review |
The test
|
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.
The tests look good. I'd just move/rename a few of the tests for consistency.
@@ -0,0 +1,22 @@ | |||
# -*- coding: utf-8 -*- |
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.
Rename this file to test_RequestWithMethod.py
to match the class it is testing and give the test function test_RequestWithMethod
a more specific name. Alternatively, move the test into test_urls.py
instead.
@@ -0,0 +1,66 @@ | |||
# -*- coding: utf-8 -*- |
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.
Rename this file to generic_urlparse.py
to match the function being tested.
from ansible.module_utils.six.moves.urllib.parse import urlparse, urlunparse | ||
|
||
|
||
def test_ParseResultDottedDict(): |
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.
Move this test function into a new test_ParseResultDottedDict.py
file to match the class it is testing and give the test function test_ParseResultDottedDict
a more specific name. Alternatively, move the test into test_urls.py instead.
The test
|
…ror_307 does not cause issues with urllib2 type redirects
A few unstable results in CI. Not related. Merging. |
* Start of tests for ansible.module_utils.urls * Start adding file for generic functions throughout urls * Add tests for maybe_add_ssl_handler * Remove commented out line * Improve coverage of maybe_add_ssl_handler, test basic_auth_header * Start tests for open_url * pep8 and ignore urlopen in test_url_open.py tests * Extend auth tests, add test for validate_certs=False * Finish tests for open_url * Add tests for fetch_url * Add fetch_url tests to replace-urlopen ignore * dummy instead of _ * Add BadStatusLine test * Reorganize/rename tests * Add tests for RedirectHandlerFactory * Add POST test to confirm behavior is to convert to GET * Update tests to handle recent changes to RedirectHandlerFactory * Special test, just to confirm that aliasing http_error_308 to http_error_307 does not cause issues with urllib2 type redirects
SUMMARY
unit tests for ansible.module_utils.urls
ISSUE TYPE
COMPONENT NAME
tests/units/module_utils/
ANSIBLE VERSION
ADDITIONAL INFORMATION