Skip to content

Commit

Permalink
Add tests on x/collection CreateContract
Browse files Browse the repository at this point in the history
  • Loading branch information
0Tech committed Apr 12, 2023
1 parent 9608448 commit 88fe2d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions x/collection/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ func (s *KeeperTestSuite) TestMsgCreateContract() {
}{
"valid request": {
owner: s.vendor,
events: sdk.Events{sdk.Event{Type:"create_collection", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x6e, 0x61, 0x6d, 0x65}, Value:[]uint8{}, Index:false}, abci.EventAttribute{Key:[]uint8{0x6d, 0x65, 0x74, 0x61}, Value:[]uint8{}, Index:false}, abci.EventAttribute{Key:[]uint8{0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64}, Value:[]uint8{0x33, 0x33, 0x33, 0x36, 0x62, 0x37, 0x36, 0x66}, Index:false}, abci.EventAttribute{Key:[]uint8{0x6f, 0x77, 0x6e, 0x65, 0x72}, Value:[]uint8{0x6c, 0x69, 0x6e, 0x6b, 0x31, 0x76, 0x39, 0x6a, 0x78, 0x67, 0x75, 0x6e, 0x39, 0x77, 0x64, 0x65, 0x6e, 0x71, 0x61, 0x32, 0x78, 0x7a, 0x66, 0x78}, Index:false}, abci.EventAttribute{Key:[]uint8{0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x6d, 0x67, 0x5f, 0x75, 0x72, 0x69}, Value:[]uint8{}, Index:false}}}, sdk.Event{Type:"lbm.collection.v1.EventCreatedContract", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64}, Value:[]uint8{0x22, 0x33, 0x33, 0x33, 0x36, 0x62, 0x37, 0x36, 0x66, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72}, Value:[]uint8{0x22, 0x6c, 0x69, 0x6e, 0x6b, 0x31, 0x76, 0x39, 0x6a, 0x78, 0x67, 0x75, 0x6e, 0x39, 0x77, 0x64, 0x65, 0x6e, 0x71, 0x61, 0x32, 0x78, 0x7a, 0x66, 0x78, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x6d, 0x65, 0x74, 0x61}, Value:[]uint8{0x22, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x6e, 0x61, 0x6d, 0x65}, Value:[]uint8{0x22, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x75, 0x72, 0x69}, Value:[]uint8{0x22, 0x22}, Index:false}}}, sdk.Event{Type:"grant_perm", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64}, Value:[]uint8{0x33, 0x33, 0x33, 0x36, 0x62, 0x37, 0x36, 0x66}, Index:false}, abci.EventAttribute{Key:[]uint8{0x74, 0x6f}, Value:[]uint8{0x6c, 0x69, 0x6e, 0x6b, 0x31, 0x76, 0x39, 0x6a, 0x78, 0x67, 0x75, 0x6e, 0x39, 0x77, 0x64, 0x65, 0x6e, 0x71, 0x61, 0x32, 0x78, 0x7a, 0x66, 0x78}, Index:false}}}, sdk.Event{Type:"grant_perm", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d}, Value:[]uint8{0x69, 0x73, 0x73, 0x75, 0x65}, Index:false}}}, sdk.Event{Type:"lbm.collection.v1.EventGranted", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64}, Value:[]uint8{0x22, 0x33, 0x33, 0x33, 0x36, 0x62, 0x37, 0x36, 0x66, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65}, Value:[]uint8{0x22, 0x6c, 0x69, 0x6e, 0x6b, 0x31, 0x76, 0x39, 0x6a, 0x78, 0x67, 0x75, 0x6e, 0x39, 0x77, 0x64, 0x65, 0x6e, 0x71, 0x61, 0x32, 0x78, 0x7a, 0x66, 0x78, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72}, Value:[]uint8{0x22, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e}, Value:[]uint8{0x22, 0x50, 0x45, 0x52, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x22}, Index:false}}}, sdk.Event{Type:"grant_perm", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d}, Value:[]uint8{0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79}, Index:false}}}, sdk.Event{Type:"lbm.collection.v1.EventGranted", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64}, Value:[]uint8{0x22, 0x33, 0x33, 0x33, 0x36, 0x62, 0x37, 0x36, 0x66, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65}, Value:[]uint8{0x22, 0x6c, 0x69, 0x6e, 0x6b, 0x31, 0x76, 0x39, 0x6a, 0x78, 0x67, 0x75, 0x6e, 0x39, 0x77, 0x64, 0x65, 0x6e, 0x71, 0x61, 0x32, 0x78, 0x7a, 0x66, 0x78, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72}, Value:[]uint8{0x22, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e}, Value:[]uint8{0x22, 0x50, 0x45, 0x52, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x4f, 0x44, 0x49, 0x46, 0x59, 0x22}, Index:false}}}, sdk.Event{Type:"grant_perm", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d}, Value:[]uint8{0x6d, 0x69, 0x6e, 0x74}, Index:false}}}, sdk.Event{Type:"lbm.collection.v1.EventGranted", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64}, Value:[]uint8{0x22, 0x33, 0x33, 0x33, 0x36, 0x62, 0x37, 0x36, 0x66, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65}, Value:[]uint8{0x22, 0x6c, 0x69, 0x6e, 0x6b, 0x31, 0x76, 0x39, 0x6a, 0x78, 0x67, 0x75, 0x6e, 0x39, 0x77, 0x64, 0x65, 0x6e, 0x71, 0x61, 0x32, 0x78, 0x7a, 0x66, 0x78, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72}, Value:[]uint8{0x22, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e}, Value:[]uint8{0x22, 0x50, 0x45, 0x52, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x4e, 0x54, 0x22}, Index:false}}}, sdk.Event{Type:"grant_perm", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d}, Value:[]uint8{0x62, 0x75, 0x72, 0x6e}, Index:false}}}, sdk.Event{Type:"lbm.collection.v1.EventGranted", Attributes:[]abci.EventAttribute{abci.EventAttribute{Key:[]uint8{0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x69, 0x64}, Value:[]uint8{0x22, 0x33, 0x33, 0x33, 0x36, 0x62, 0x37, 0x36, 0x66, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65}, Value:[]uint8{0x22, 0x6c, 0x69, 0x6e, 0x6b, 0x31, 0x76, 0x39, 0x6a, 0x78, 0x67, 0x75, 0x6e, 0x39, 0x77, 0x64, 0x65, 0x6e, 0x71, 0x61, 0x32, 0x78, 0x7a, 0x66, 0x78, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72}, Value:[]uint8{0x22, 0x22}, Index:false}, abci.EventAttribute{Key:[]uint8{0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e}, Value:[]uint8{0x22, 0x50, 0x45, 0x52, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x52, 0x4e, 0x22}, Index:false}}}},
},
}

Expand All @@ -395,9 +396,9 @@ func (s *KeeperTestSuite) TestMsgCreateContract() {

s.Require().NotNil(res)

// if s.deterministic {
// s.Require().Equal(tc.events, ctx.EventManager().Events())
// }
if s.deterministic {
s.Require().Equal(tc.events, ctx.EventManager().Events())
}
})
}
}
Expand Down

0 comments on commit 88fe2d3

Please sign in to comment.