From 6a668efa1c52e4ed17ffb846886ef26e2dfea5f9 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Thu, 8 Jun 2023 17:31:08 -0400 Subject: [PATCH] [6.14.z] Close-loop 1757394 (#11625) --- tests/foreman/api/test_user.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/foreman/api/test_user.py b/tests/foreman/api/test_user.py index 05a6a649b9..2932e3b1ae 100644 --- a/tests/foreman/api/test_user.py +++ b/tests/foreman/api/test_user.py @@ -399,6 +399,37 @@ def test_negative_create_with_blank_authorized_by(self): with pytest.raises(HTTPError): entities.User(auth_source='').create() + @pytest.mark.tier1 + def test_positive_table_preferences(self, module_target_sat): + """Create a user, create their Table Preferences, read it + + :id: 10fda3f1-4fee-461b-a413-a4d1fa098a94 + + :expectedresults: Table Preferences can be accessed + + :CaseImportance: Medium + + :customerscenario: true + + :BZ: 1757394 + """ + existing_roles = entities.Role().search() + password = gen_string('alpha') + user = entities.User(role=existing_roles, password=password).create() + name = "hosts" + columns = ["power_status", "name", "comment"] + sc = ServerConfig(auth=(user.login, password), url=module_target_sat.url, verify=False) + entities.TablePreferences(sc, user=user, name=name, columns=columns).create() + table_preferences = entities.TablePreferences(sc, user=user).search() + assert len(table_preferences) == 1 + tp = table_preferences[0] + assert hasattr(tp, 'name') + assert hasattr(tp, 'columns') + assert tp.name == 'hosts' + assert len(tp.columns) == len(columns) + for column in columns: + assert column in tp.columns + class TestUserRole: """Test associations between users and roles."""