Skip to content

Commit

Permalink
Fixed Merge Conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Multani <[email protected]>
  • Loading branch information
HarshMultani-AyanWorks committed May 6, 2021
1 parent d9d90a1 commit 6fbfbbd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
11 changes: 0 additions & 11 deletions aries_cloudagent/protocols/endorse_transaction/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,24 +666,13 @@ async def set_endorser_info(request: web.BaseRequest):
" in connection metadata for this connection record"
)
)
if "transaction_their_job" not in jobs.keys():
raise web.HTTPForbidden(
reason=(
'Ask the other agent to set up "transaction_my_job" in '
'"transaction_jobs" in connection metadata for their connection record'
)
)
if jobs["transaction_my_job"] != TransactionJob.TRANSACTION_AUTHOR.name:
raise web.HTTPForbidden(
reason=(
"Only a TRANSACTION_AUTHOR can add endorser_info "
"to metadata of its connection record"
)
)
if jobs["transaction_their_job"] != TransactionJob.TRANSACTION_ENDORSER.name:
raise web.HTTPForbidden(
reason="The Other agent should have job TRANSACTION_ENDORSER"
)
value = await record.metadata_get(session, "endorser_info")
if value:
value["endorser_did"] = endorser_did
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1427,25 +1427,6 @@ async def test_set_endorser_info_no_transaction_my_job_x(self):
with self.assertRaises(test_module.web.HTTPForbidden):
await test_module.set_endorser_info(self.request)

async def test_set_endorser_info_no_transaction_their_job_x(self):
self.request.match_info = {"conn_id": "dummy"}
self.request.query = {"endorser_did": "did", "endorser_name": "name"}

with async_mock.patch.object(
ConnRecord, "retrieve_by_id", async_mock.CoroutineMock()
) as mock_conn_rec_retrieve:
mock_conn_rec_retrieve.return_value = async_mock.MagicMock(
metadata_get=async_mock.CoroutineMock(
return_value={
"transaction_my_job": (
test_module.TransactionJob.TRANSACTION_AUTHOR.name
),
}
)
)
with self.assertRaises(test_module.web.HTTPForbidden):
await test_module.set_endorser_info(self.request)

async def test_set_endorser_info_my_wrong_job_x(self):
self.request.match_info = {"conn_id": "dummy"}
self.request.query = {"endorser_did": "did", "endorser_name": "name"}
Expand All @@ -1466,26 +1447,6 @@ async def test_set_endorser_info_my_wrong_job_x(self):
with self.assertRaises(test_module.web.HTTPForbidden):
await test_module.set_endorser_info(self.request)

async def test_set_endorser_info_their_wrong_job_x(self):
self.request.match_info = {"conn_id": "dummy"}
self.request.query = {"endorser_did": "did", "endorser_name": "name"}
with async_mock.patch.object(
ConnRecord, "retrieve_by_id", async_mock.CoroutineMock()
) as mock_conn_rec_retrieve:
mock_conn_rec_retrieve.return_value = async_mock.MagicMock(
metadata_get=async_mock.CoroutineMock(
return_value={
"transaction_my_job": (
test_module.TransactionJob.TRANSACTION_AUTHOR.name
),
"transaction_their_job": "a suffusion of yellow",
}
)
)

with self.assertRaises(test_module.web.HTTPForbidden):
await test_module.set_endorser_info(self.request)

"""
async def test_transaction_write_schema_txn(self):
self.request.match_info = {"tran_id": "dummy"}
Expand Down

0 comments on commit 6fbfbbd

Please sign in to comment.