Skip to content

Commit

Permalink
Add warning log for uyuni custom channels
Browse files Browse the repository at this point in the history
  • Loading branch information
maximenoel8 committed Nov 13, 2024
1 parent f1bfbf7 commit 9dc36e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def delete_software_channels(self):
if "custom" in channel['label'] and not any(protected in channel['label'] for protected in self.resources_to_delete):
logger.info(f"Delete custom channel: {channel['label']}")
self.client.channel.software.delete(self.session_key, channel['label'])
logging.warning("Delete only custom channels for uyuni.")
logging.warning("Delete only custom channels for uyuni")
return

for channel in channels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,15 @@ def test_delete_channel_repos(self):
self.mock_client.channel.software.removeRepo.assert_any_call("mock_session_key", "repo1")
self.mock_client.channel.software.removeRepo.assert_any_call("mock_session_key", "repo2")

def test_delete_software_channels_skipped_for_uyuni(self):
def test_delete_software_channels_warning_for_uyuni(self):
# Set the product_version to "uyuni" to simulate Uyuni environment
self.resource_manager.product_version = "uyuni"

# Patch logging to capture warning message
with patch('logging.warning') as mock_warning:
self.resource_manager.delete_software_channels()
# Check if the warning message was logged
mock_warning.assert_called_once_with("Delete channels not supported for uyuni")

# Ensure no deletion calls were made
self.mock_client.channel.software.delete.assert_not_called()
mock_warning.assert_called_once_with("Delete only custom channels for uyuni")

def test_delete_salt_keys(self):
self.mock_client.saltkey.acceptedList.return_value = [
Expand Down

0 comments on commit 9dc36e5

Please sign in to comment.