Skip to content

Commit

Permalink
Removing AID delete
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfomiranda committed Jun 30, 2024
1 parent 6bdb608 commit 839fda5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 48 deletions.
36 changes: 0 additions & 36 deletions src/keria/app/aiding.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,42 +746,6 @@ def on_put(self, req, rep, name):
rep.content_type = "application/json"
rep.data = json.dumps(data).encode("utf-8")

def on_delete(self, req, rep, name):
"""Identifier delete endpoint
Parameters:
req (Request): falcon.Request HTTP request object
rep (Response): falcon.Response HTTP response object
name (str): human-readable name for Hab to delete
---
summary: Delete an identifier.
description: This endpoint deletes an identifier by its name.
tags:
- Identifier
parameters:
- in: path
name: name
schema:
type: string
required: true
description: The human-readable name of the identifier.
responses:
200:
description: Successfully deleted the identifier.
400:
description: Bad request. This could be due to a missing or invalid name parameter.
404:
description: The requested identifier was not found.
"""
if not name:
raise falcon.HTTPBadRequest(description="name is required")
agent = req.context.agent
hab = agent.hby.habByName(name)
if hab is None:
raise falcon.HTTPNotFound(title=f"No AID with name {name} found")
agent.hby.deleteHab(name)
rep.status = falcon.HTTP_200

def on_post(self, req, rep, name):
"""Identifier events endpoint
Expand Down
15 changes: 4 additions & 11 deletions tests/app/test_aiding.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,6 @@ def test_identifier_collection_end(helpers):
aid = res.json
assert aid["name"] == "aid3Renamed"

# delete aid3renamed
res = client.simulate_delete(path="/identifiers/aid3Renamed")
assert res.status_code == 200
res = client.simulate_get(path="/identifiers")
assert res.status_code == 200
assert len(res.json) == 2

# create member habs for group AID
p1 = p1hby.makeHab(name="p1")
assert p1.pre == "EBPtjiAY9ITdvScWFGeeCu3Pf6_CFFr57siQqffVt9Of"
Expand Down Expand Up @@ -619,8 +612,8 @@ def test_identifier_collection_end(helpers):

res = client.simulate_get(path="/identifiers")
assert res.status_code == 200
assert len(res.json) == 3
aid = res.json[2]
assert len(res.json) == 4
aid = res.json[3]
assert aid["name"] == "multisig"
assert aid["prefix"] == serder.pre
group = aid["group"]
Expand Down Expand Up @@ -688,8 +681,8 @@ def test_identifier_collection_end(helpers):
# Make sure keys got rotated
res = client.simulate_get(path="/identifiers")
assert res.status_code == 200
assert len(res.json) == 3
aid = res.json[2]
assert len(res.json) == 4
aid = res.json[3]
assert aid["name"] == "multisig"
assert aid["prefix"] == rserder.pre
group = aid["group"]
Expand Down
Loading

0 comments on commit 839fda5

Please sign in to comment.