Skip to content

Commit

Permalink
✅ Update ISCN authz test case (and also some error message)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnkken committed Jan 4, 2023
1 parent 430a3a6 commit 68207c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions x/iscn/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,8 @@ func TestUpdateAuthorization(t *testing.T) {
Stakeholders: []types.IscnInput{stakeholder1, stakeholder2},
ContentMetadata: contentMetadata2,
}
msg = types.NewMsgCreateIscnRecord(addr3, &record)
result = app.DeliverMsgNoError(t, msg, priv3)
msg = types.NewMsgCreateIscnRecord(addr1, &record)
result = app.DeliverMsgNoError(t, msg, priv1)
iscnId3 := testutil.GetIscnIdFromResult(t, result)

record = types.IscnRecord{
Expand All @@ -921,9 +921,9 @@ func TestUpdateAuthorization(t *testing.T) {
ContentMetadata: contentMetadata2,
}

updateMsg = types.NewMsgUpdateIscnRecord(addr3, iscnId3, &record)
updateMsg = types.NewMsgUpdateIscnRecord(addr1, iscnId3, &record)
msgExec = authz.NewMsgExec(addr2, []sdk.Msg{updateMsg})
msg = &msgExec
_, _, simErr, _ = app.DeliverMsg(msg, priv2)
require.ErrorContains(t, simErr, "authorization not found")
require.ErrorContains(t, simErr, "ISCN ID prefix mismatch")
}
2 changes: 1 addition & 1 deletion x/iscn/types/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (a UpdateAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authz.AcceptR
return authz.AcceptResponse{}, sdkerrors.ErrLogic.Wrapf("authorization has invalid ISCN ID prefix: %v", err)
}
if !iscnId.PrefixEqual(&authIscnIdPrefix) {
return authz.AcceptResponse{}, sdkerrors.ErrUnauthorized.Wrap("iscn id prefix mismatch")
return authz.AcceptResponse{}, sdkerrors.ErrUnauthorized.Wrap("ISCN ID prefix mismatch")
}

return authz.AcceptResponse{Accept: true}, nil
Expand Down

0 comments on commit 68207c5

Please sign in to comment.