Skip to content

Commit

Permalink
feat(test): Adding docstrings to test_unregister.py
Browse files Browse the repository at this point in the history
Solves CCT-672
  • Loading branch information
zpetrace committed Oct 1, 2024
1 parent 59a2205 commit 9e40729
Showing 1 changed file with 44 additions and 7 deletions.
51 changes: 44 additions & 7 deletions integration-tests/test_unregister.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
"""
:casecomponent: insights-client
:requirement: RHSS-291297
:subsystemteam: sst_csi_client_tools
:caseautomation: Automated
:upstream: Yes
"""

import pytest
import conftest

pytestmark = pytest.mark.usefixtures("register_subman")


def test_unregister(insights_client):
"""Test insights-client --unregister after registering it
If the unregistration is successful, `unregister` method returns True
"""
:id: ecaeeddc-4c8b-4f17-8d69-1c81d2c7c744
:title: Test unregister
:description:
This test verifies that the insights-client can be unregistered
successfully after being registered.
:tier: Tier 1
:steps:
1. Register the insights-client if not registered
2. Run `insights-client --unregister` command
3. Confirm the client is unregistered
:expectedresults:
1. The client registers successfully
2. Command outputs "Successfully unregistered from the
Red Hat Insights Service".
3. Client unregistration is confirmed
"""
insights_client.register()
assert conftest.loop_until(lambda: insights_client.is_registered)
Expand All @@ -21,10 +42,26 @@ def test_unregister(insights_client):


def test_unregister_twice(insights_client):
"""Test insights-client --unregister on unregistered system
If the unregistration is successful, `--unregister` returns True on first attempt
and false on subsequent attempts."""

"""
:id: bfff1b33-5f19-42d2-a6ff-4598975873e5
:title: Test unregister already unregistered system
:description:
This test verifies that attempting to unregister the insights client
when it is already unregistered behaves as expected. It checks that
the first unregistration succeeds and that subsequent unregistration
attempts produce the appropriate error message and return code
:tier: Tier 1
:steps:
1. Register the insights-client
2. Unregister the client for the first time
3. Attempt to unregister the client a second time
:expectedresults:
1. The client registers successfully
2. Command outputs "Successfully unregistered from the
Red Hat Insights Service"
3. Command returns exit code 1 and outputs "This host is not registered,
unregistration is not applicable."
"""
insights_client.register()
assert conftest.loop_until(lambda: insights_client.is_registered)

Expand Down

0 comments on commit 9e40729

Please sign in to comment.