Skip to content

Commit

Permalink
Add test scenario for disconnected option of rh_cloud report
Browse files Browse the repository at this point in the history
  • Loading branch information
jameerpathan111 committed Nov 29, 2023
1 parent a9ffccd commit 277363a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,11 +2207,13 @@ def enroll_ad_and_configure_external_auth(self, ad_data):
self.execute('systemctl daemon-reload && systemctl restart httpd.service').status == 0
)

def generate_inventory_report(self, org):
def generate_inventory_report(self, org, disconnected='false'):
"""Function to perform inventory upload."""
generate_report_task = 'ForemanInventoryUpload::Async::UploadReportJob'
timestamp = datetime.utcnow().strftime('%Y-%m-%d %H:%M')
self.api.Organization(id=org.id).rh_cloud_generate_report()
self.api.Organization(id=org.id).rh_cloud_generate_report(
data={'disconnected': disconnected}
)
wait_for(
lambda: self.api.ForemanTask()
.search(query={'search': f'{generate_report_task} and started_at >= "{timestamp}"'})[0]
Expand Down
5 changes: 3 additions & 2 deletions tests/foreman/api/test_rhcloud_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def test_inventory_upload_with_http_proxy():

@pytest.mark.run_in_one_thread
@pytest.mark.tier2
@pytest.mark.e2e
def test_include_parameter_tags_setting(
inventory_settings,
rhcloud_manifest_org,
Expand All @@ -237,7 +238,7 @@ def test_include_parameter_tags_setting(
2. Register a content host with satellite.
3. Create a host parameter with long text value.
4. Create Hostcollection with name containing double quotes.
5. Generate inventory report.
5. Generate inventory report with disconnected option.
6. Assert that generated report contains valid json file.
7. Observe the tag generated from the parameter.
Expand Down Expand Up @@ -272,7 +273,7 @@ def test_include_parameter_tags_setting(
local_report_path = robottelo_tmp_dir.joinpath(f'{gen_alphanumeric()}_{org.id}.tar.xz')
# Enable include_parameter_tags setting
module_target_sat.update_setting('include_parameter_tags', True)
module_target_sat.generate_inventory_report(org)
module_target_sat.generate_inventory_report(org, disconnected='true')
# Download report
module_target_sat.api.Organization(id=org.id).rh_cloud_download_report(
destination=local_report_path
Expand Down

0 comments on commit 277363a

Please sign in to comment.