From c775f278043e56befba8e2dd85f362e21ce7dca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hellebrandt?= Date: Mon, 11 Sep 2023 08:28:56 +0200 Subject: [PATCH] AK update must contain org id, it is a required field (#12509) --- tests/foreman/api/test_permission.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/foreman/api/test_permission.py b/tests/foreman/api/test_permission.py index 68068453295..1dac5452ade 100644 --- a/tests/foreman/api/test_permission.py +++ b/tests/foreman/api/test_permission.py @@ -367,8 +367,18 @@ def test_positive_check_update(self, entity_cls, class_org, class_location): new_entity = new_entity.create() name = new_entity.get_fields()['name'].gen_value() with pytest.raises(HTTPError): - entity_cls(self.cfg, id=new_entity.id, name=name).update(['name']) + if entity_cls is entities.ActivationKey: + entity_cls(self.cfg, id=new_entity.id, name=name, organization=class_org).update( + ['name'] + ) + else: + entity_cls(self.cfg, id=new_entity.id, name=name).update(['name']) self.give_user_permission(_permission_name(entity_cls, 'update')) # update() calls read() under the hood, which triggers # permission error - entity_cls(self.cfg, id=new_entity.id, name=name).update_json(['name']) + if entity_cls is entities.ActivationKey: + entity_cls(self.cfg, id=new_entity.id, name=name, organization=class_org).update_json( + ['name'] + ) + else: + entity_cls(self.cfg, id=new_entity.id, name=name).update_json(['name'])