From befe2de4ec28715b1dc909211d0e30c079a5aeae Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 10 Sep 2024 13:27:05 +0200 Subject: [PATCH] Avoid calling decode on str (#16214) * Avoid calling decode on str In tests we see this failure: AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'? This implies that the strerr value is a str, which you can't decode. I can't find the specific change, but this implies the result used to be a byte string and is now decoded elsewhere. * Update tests/foreman/destructive/test_rename.py Co-authored-by: Peter Ondrejka * Update tests/foreman/destructive/test_rename.py Co-authored-by: Evgeni Golov --------- Co-authored-by: Peter Ondrejka Co-authored-by: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Co-authored-by: Evgeni Golov (cherry picked from commit 5c05d4fd72c0ad5472c0d8cc1a3702cce27f6f9b) --- tests/foreman/destructive/test_rename.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/foreman/destructive/test_rename.py b/tests/foreman/destructive/test_rename.py index 8f06cd7a5f8..c267b8dd346 100644 --- a/tests/foreman/destructive/test_rename.py +++ b/tests/foreman/destructive/test_rename.py @@ -191,7 +191,10 @@ def test_negative_rename_sat_wrong_passwd(module_target_sat): f'satellite-change-hostname -y {new_hostname} -u {username} -p {password}' ) assert result.status == 1 - assert BAD_CREDS_MSG in result.stderr[1].decode() + assert BAD_CREDS_MSG in result.stderr + # assert no changes were made + hostname_result = module_target_sat.execute('hostname') + assert original_name == hostname_result.stdout.strip(), "Invalid hostame assigned" @pytest.mark.stubbed