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

Added more unit tests for redhat_subscription module #58665

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
3 participants
@jirihnidek
Copy link

commented Jul 3, 2019

SUMMARY
  • Added several unit tests for redhat_subscription module
  • Fixed the redhat_subscription module:
    • Option 'pool_ids' works in Python3 now
    • It tries to attach only pools IDs that are available
    • Optimization of code: do not call list --available, when
      no pool is requested
    • Simplified configure() method
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

redhat_subscription

ADDITIONAL INFORMATION

Unit tests can be tested using:

ansible-test units --python 3.7 test/units/modules/packaging/os/test_redhat_subscription.py
@jirihnidek

This comment has been minimized.

Copy link
Author

commented Jul 3, 2019

I created PR with two unit test on Monday: #58590. This PR extends original PR (12 more unit tests and other optimization).

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2019

@jirihnidek

This comment has been minimized.

Copy link
Author

commented Jul 8, 2019

I'm rewriting unit test using pytest module according feedback in #58590.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

The test ansible-test sanity --test pylint [explain] failed with 2 errors:

test/units/modules/packaging/os/test_redhat_subscription.py:87:38: bad-whitespace No space allowed before bracket                     {'check_rc': True },                                       ^
test/units/modules/packaging/os/test_redhat_subscription.py:176:16: bad-whitespace No space allowed after bracket                 (   [                 ^

The test ansible-test sanity --test pep8 [explain] failed with 6 errors:

test/units/modules/packaging/os/test_redhat_subscription.py:87:38: E202 whitespace before '}'
test/units/modules/packaging/os/test_redhat_subscription.py:94:46: E231 missing whitespace after ','
test/units/modules/packaging/os/test_redhat_subscription.py:176:18: E201 whitespace after '('
test/units/modules/packaging/os/test_redhat_subscription.py:177:25: E126 continuation line over-indented for hanging indent
test/units/modules/packaging/os/test_redhat_subscription.py:182:21: E121 continuation line under-indented for hanging indent
test/units/modules/packaging/os/test_redhat_subscription.py:185:17: E124 closing bracket does not match visual indentation

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

The test ansible-test sanity --test pylint [explain] failed with 1 error:

test/units/modules/packaging/os/test_redhat_subscription.py:28:21: bad-whitespace No space allowed around keyword argument assignment         return_value = '/testbin/subscription-manager')                      ^

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

test/units/modules/packaging/os/test_redhat_subscription.py:28:9: E128 continuation line under-indented for visual indent
test/units/modules/packaging/os/test_redhat_subscription.py:28:21: E251 unexpected spaces around keyword / parameter equals
test/units/modules/packaging/os/test_redhat_subscription.py:28:23: E251 unexpected spaces around keyword / parameter equals

click here for bot help

@ansibot ansibot removed the ci_verified label Jul 10, 2019

Added unit tests for redhat_subscription module
* Added several unit tests for redhat_subscription module
* Fixed the redhat_subscription module:
  - Option 'pool_ids' works in Python3 now
  - It tries to attach only pools IDs that are available
  - Optimization of code: do not call list --available, when
    no pool is requested
  - Simplified configure() method
  - Small changes to generate same commands on Python2 and Python3.
    Order of arguments/options and pool IDs have to be same to
    be able to run unit test using Python2 and Python3.
* TODO: add more unit tests

@jirihnidek jirihnidek force-pushed the jirihnidek:more_unit_tests_of_redhat_subscription branch from 081cf1f to 0fcea14 Jul 10, 2019

@jirihnidek

This comment has been minimized.

Copy link
Author

commented Jul 10, 2019

@samdoran Hi, please can you review this PR? I have plant to add more unit tests into test_redhat_subscription.py, but I want to know first, if I'm using right approach.

@ansibot ansibot added core_review and removed needs_revision labels Jul 10, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2019

The test ansible-test sanity --test pep8 [explain] failed with 5 errors:

test/units/modules/packaging/os/test_redhat_subscription.py:346:36: E231 missing whitespace after ':'
test/units/modules/packaging/os/test_redhat_subscription.py:413:36: E231 missing whitespace after ':'
test/units/modules/packaging/os/test_redhat_subscription.py:513:36: E231 missing whitespace after ':'
test/units/modules/packaging/os/test_redhat_subscription.py:613:36: E231 missing whitespace after ':'
test/units/modules/packaging/os/test_redhat_subscription.py:730:36: E231 missing whitespace after ':'

click here for bot help

@bcoca bcoca removed the needs_triage label Jul 11, 2019

@bcoca bcoca requested a review from samdoran Jul 11, 2019

@jirihnidek jirihnidek force-pushed the jirihnidek:more_unit_tests_of_redhat_subscription branch from b0474cb to 20fe249 Jul 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.