Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AK update must contain org id, it is a required field #12509

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/foreman/api/test_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Loading