Skip to content

Commit 981cc6d

Browse files
cjhowlandryjones
authored andcommitted
fix: endpoint attrib json object with one top level key "endpoint"
Signed-off-by: Char Howland <char@indicio.tech>
1 parent 13110bf commit 981cc6d

3 files changed

Lines changed: 32 additions & 20 deletions

File tree

aries_cloudagent/ledger/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ async def _construct_attr_json(
101101
if all_exist_endpoints:
102102
all_exist_endpoints[endpoint_type.indy] = endpoint
103103
all_exist_endpoints["routingKeys"] = routing_keys
104-
attr_json = json.dumps(all_exist_endpoints)
104+
attr_json = json.dumps({"endpoint": all_exist_endpoints})
105105

106106
else:
107107
endpoint_dict = {endpoint_type.indy: endpoint}
108108
endpoint_dict["routingKeys"] = routing_keys
109-
attr_json = json.dumps(endpoint_dict)
109+
attr_json = json.dumps({"endpoint": endpoint_dict})
110110

111111
return attr_json
112112

aries_cloudagent/ledger/tests/test_indy.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,8 +2312,10 @@ async def test_construct_attr_json_with_routing_keys(self, mock_close, mock_open
23122312
)
23132313
assert attr_json == json.dumps(
23142314
{
2315-
"endpoint": "https://url",
2316-
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
2315+
"endpoint": {
2316+
"endpoint": "https://url",
2317+
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
2318+
}
23172319
}
23182320
)
23192321

@@ -2333,9 +2335,11 @@ async def test_construct_attr_json_with_routing_keys_all_exist_endpoints(
23332335
)
23342336
assert attr_json == json.dumps(
23352337
{
2336-
"profile": "https://endpoint/profile",
2337-
"endpoint": "https://url",
2338-
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
2338+
"endpoint": {
2339+
"profile": "https://endpoint/profile",
2340+
"endpoint": "https://url",
2341+
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
2342+
}
23392343
}
23402344
)
23412345

aries_cloudagent/ledger/tests/test_indy_vdr.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -615,40 +615,48 @@ async def test_update_endpoint_for_did(
615615
{"profile": "https://endpoint/profile"},
616616
["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
617617
{
618-
"profile": "https://endpoint/profile",
619-
"endpoint": "https://url",
620-
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
618+
"endpoint": {
619+
"profile": "https://endpoint/profile",
620+
"endpoint": "https://url",
621+
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
622+
}
621623
},
622624
),
623625
(
624626
{"profile": "https://endpoint/profile"},
625627
None,
626628
{
627-
"profile": "https://endpoint/profile",
628-
"endpoint": "https://url",
629-
"routingKeys": [],
629+
"endpoint": {
630+
"profile": "https://endpoint/profile",
631+
"endpoint": "https://url",
632+
"routingKeys": [],
633+
}
630634
},
631635
),
632636
(
633637
None,
634638
["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
635639
{
636-
"endpoint": "https://url",
637-
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
640+
"endpoint": {
641+
"endpoint": "https://url",
642+
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
643+
}
638644
},
639645
),
640-
(None, None, {"endpoint": "https://url", "routingKeys": []}),
646+
(None, None, {"endpoint": {"endpoint": "https://url", "routingKeys": []}}),
641647
(
642648
{
643649
"profile": "https://endpoint/profile",
644650
"spec_divergent_endpoint": "https://endpoint",
645651
},
646652
["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
647653
{
648-
"profile": "https://endpoint/profile",
649-
"spec_divergent_endpoint": "https://endpoint",
650-
"endpoint": "https://url",
651-
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
654+
"endpoint": {
655+
"profile": "https://endpoint/profile",
656+
"spec_divergent_endpoint": "https://endpoint",
657+
"endpoint": "https://url",
658+
"routingKeys": ["3YJCx3TqotDWFGv7JMR5erEvrmgu5y4FDqjR7sKWxgXn"],
659+
}
652660
},
653661
),
654662
],

0 commit comments

Comments
 (0)