alex-astronomer edited a comment on pull request #18820:
URL: https://github.com/apache/airflow/pull/18820#issuecomment-939184181


   Not sure how to request permission to add to this PR but will you please add 
this test to confirm that #18813 was fixed?
   
   ```
       def test_patch_updates_correct_roles_permissions(self):
           """
           Issue described in #18813, fixed by #18820
           """
           role_to_change = create_role(self.app, "patched_role")
           existing_role = create_role(self.app, "already_exists")
           assert len(role_to_change.permissions) == 0
           assert len(existing_role.permissions) == 0
           payload = {
               "name": "already_exists",
               "actions": [{"action": {"name": "can_delete"}, "resource": 
{"name": "XComs"}}],
           }
           response = self.client.patch(
               f"/api/v1/roles/{role_to_change.name}", json=payload, 
environ_overrides={"REMOTE_USER": "test"}
           )
           assert response.status_code == 200
           # have to use find_role because the session becomes detached during 
the test from the
           # previous role definitions
           assert 
len(self.app.appbuilder.sm.find_role("patched_role").permissions) == 1
           assert 
len(self.app.appbuilder.sm.find_role("already_exists").permissions) == 0
           expected_permission = role_to_change.permissions[0]
           assert (expected_permission.permission.name, 
expected_permission.view_menu.name) == (
               "can_delete",
               "XComs",
           )
   ```
   
   This test fails on main but is corrected with #18820 (this PR)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to