LakeFormation: deregister_resource() should handle unknown resources (#7023)

This commit is contained in:
Bert Blommers 2023-11-13 22:21:09 -01:00 committed by GitHub
parent c14df137d5
commit d3efa2afb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -56,6 +56,8 @@ class LakeFormationBackend(BaseBackend):
return self.resources[resource_arn]
def deregister_resource(self, resource_arn: str) -> None:
if resource_arn not in self.resources:
raise EntityNotFound
del self.resources[resource_arn]
def register_resource(self, resource_arn: str, role_arn: str) -> None:

View File

@ -41,6 +41,11 @@ def test_deregister_resource():
err = exc.value.response["Error"]
assert err["Code"] == "EntityNotFoundException"
with pytest.raises(ClientError) as exc:
client.deregister_resource(ResourceArn="some arn")
err = exc.value.response["Error"]
assert err["Code"] == "EntityNotFoundException"
@mock_lakeformation
def test_list_resources():