-
Notifications
You must be signed in to change notification settings - Fork 136
Add test coverage for SAT-28860 #17153
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ def make_http_proxy(self, org, http_proxy_type): | |
| name=gen_string('alpha', 15), | ||
| url=settings.http_proxy.un_auth_proxy_url, | ||
| organization=[org.id], | ||
| content_default_http_proxy=True, | ||
| ).create() | ||
| if http_proxy_type: | ||
| return self._satellite.api.HTTPProxy( | ||
|
|
@@ -47,6 +48,7 @@ def make_http_proxy(self, org, http_proxy_type): | |
| username=settings.http_proxy.username, | ||
| password=settings.http_proxy.password, | ||
| organization=[org.id], | ||
| content_default_http_proxy=True, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we want to always do this on proxy create via
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vsedmik Yes, the fixture behaviour is still same, if we make it non-default then we had to configure the setting explicitely and that step we have removed it from this setup fixture, and this new option configures the setting on create |
||
| ).create() | ||
| return None | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,7 +201,9 @@ def test_positive_assign_http_proxy_to_products_repositories( | |
| @pytest.mark.tier1 | ||
| @pytest.mark.run_in_one_thread | ||
| @pytest.mark.parametrize('setting_update', ['content_default_http_proxy'], indirect=True) | ||
| def test_set_default_http_proxy(module_org, module_location, setting_update, target_sat): | ||
| def test_set_default_http_proxy_no_global_default( | ||
| module_org, module_location, setting_update, target_sat | ||
| ): | ||
| """Setting "Default HTTP proxy" to "no global default". | ||
|
|
||
| :id: e93733e1-5c05-4b7f-89e4-253b9ce55a5a | ||
|
|
@@ -244,6 +246,59 @@ def test_set_default_http_proxy(module_org, module_location, setting_update, tar | |
| assert result['table'][0]['Value'] == "Empty" | ||
|
|
||
|
|
||
| @pytest.mark.tier1 | ||
Gauravtalreja1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @pytest.mark.run_in_one_thread | ||
| @pytest.mark.parametrize('setting_update', ['content_default_http_proxy'], indirect=True) | ||
| def test_positive_set_default_http_proxy( | ||
| request, module_org, module_location, setting_update, target_sat | ||
| ): | ||
| """Setting "Default HTTP proxy" when new HTTP proxy is created. | ||
|
|
||
| :id: e93733e1-5c05-4b7f-89e4-253b9ce55a5b | ||
|
|
||
| :steps: | ||
| 1. Navigate to Infrastructure > Http Proxies | ||
| 2. Create a Http Proxy and set "Default content HTTP proxy" | ||
| 3. Navigate to Administer > Settings > Content tab | ||
| 4. Verify the "Default HTTP Proxy" setting with created above. | ||
| 5. Update "Default HTTP Proxy" to "no global default". | ||
|
|
||
| :Verifies: SAT-28860 | ||
|
|
||
| :expectedresults: Creating Http Proxy with option "Default content HTTP proxy", | ||
| updates setting "Default HTTP Proxy" succesfully. | ||
| """ | ||
| property_name = setting_update.name | ||
| http_proxy_name = gen_string('alpha', 15) | ||
| http_proxy_url = settings.http_proxy.un_auth_proxy_url | ||
|
|
||
| with target_sat.ui_session() as session: | ||
| session.http_proxy.create( | ||
Gauravtalreja1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| 'http_proxy.name': http_proxy_name, | ||
| 'http_proxy.url': http_proxy_url, | ||
| 'http_proxy.content_default_http_proxy': 'true', | ||
| 'locations.resources.assigned': [module_location.name], | ||
| 'organizations.resources.assigned': [module_org.name], | ||
| } | ||
| ) | ||
|
|
||
| # Teardown | ||
| @request.addfinalizer | ||
| def _finalize(): | ||
| target_sat.api.HTTPProxy().search(query={'search': f'name={http_proxy_name}'})[ | ||
| 0 | ||
| ].delete() | ||
| default_proxy = target_sat.api.Setting().search( | ||
| query={'search': 'name=content_default_http_proxy'} | ||
| )[0] | ||
| assert default_proxy.value != http_proxy_name | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a good practice to do assertions in teardown. Can we handle assertions in the test and keep the cleanup part separate? The results are misleading when debugging failures.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so it'll mislead us while debugging any failures, instead I think teardowns are best to ensure the Satellite we're using is in the same state as it was before, and adding assertions there, ensures everything worked in setup and teardown |
||
| assert not default_proxy.value | ||
|
|
||
| result = session.settings.read(f'name = {property_name}') | ||
| assert result['table'][0]['Value'] == f'{http_proxy_name} ({http_proxy_url})' | ||
|
|
||
|
|
||
| @pytest.mark.tier1 | ||
| @pytest.mark.run_in_one_thread | ||
| @pytest.mark.parametrize('setting_update', ['content_default_http_proxy'], indirect=True) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.