Skip to content

Commit

Permalink
feat(test): Adding docstrings to test_status.py
Browse files Browse the repository at this point in the history
Solves CCT-671
  • Loading branch information
zpetrace authored and m-horky committed Sep 27, 2024
1 parent 1080f0c commit e89f7b5
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions integration-tests/test_status.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
:casecomponent: insights-client
:requirement: RHSS-291297
:subsystemteam: sst_csi_client_tools
:caseautomation: Automated
:upstream: Yes
"""

import contextlib
import pytest
from time import sleep
Expand All @@ -8,8 +16,23 @@

def test_status_registered(external_candlepin, insights_client):
"""
Test `insights-client --status` when the client is registered;
in case of legacy_upload status command returns a different output.
:id: 624b01fc-e841-4c26-afd8-bb28eaf7fe75
:title: Test insights-client --status when registered
:description:
This test verifies that when the insights client is registered, the
`insights-client --status` command outputs the correct registration status
:reference:
:tier: Tier 1
:steps:
1. Register the insights-client
2. Wait briefly to ensure inventory is up-to-date
3. Run `insights-client --status` command
:expectedresults:
1. The client registers successfully
2. Wait time completes without issues
3. If 'legacy_upload' is True, output contains "Insights API confirms
registration." If 'legacy_upload' is False, output is "This host
is registered.\n"
"""
insights_client.register()
assert conftest.loop_until(lambda: insights_client.is_registered)
Expand All @@ -24,8 +47,23 @@ def test_status_registered(external_candlepin, insights_client):

def test_status_unregistered(external_candlepin, insights_client):
"""
Test `insights-client --status` when the client is unregistered;
in case of legacy_upload status command returns a different output.
:id: aa37831a-a581-44db-a7c9-de8161767c7e
:title: Test insights-client --status when unregistered
:description:
This test verifies that when the insights client is unregistered, the
`insights-client --status` command outputs the correct unregistration
status
:reference:
:tier: Tier 1
:steps:
1. Unregister the insights client to ensure it's unregistered
2. Run `insights-client --status` command
:expectedresults:
1. The client unregisters successfully
2. If 'legacy_upload' is True return code is 1 and output contains
"Insights API says this machine is NOT registered."
If 'legacy_upload' is False return code is 0 and output contains
"This host is unregistered.\n"
"""
# running unregistration to ensure system is unregistered
with contextlib.suppress(Exception):
Expand Down

0 comments on commit e89f7b5

Please sign in to comment.