diff --git a/x/attribute/handler_test.go b/x/attribute/handler_test.go index 3dea3dbc95..44ce320fef 100644 --- a/x/attribute/handler_test.go +++ b/x/attribute/handler_test.go @@ -75,8 +75,8 @@ type CommonTest struct { expectedEvent proto.Message } -func (s HandlerTestSuite) containsMessage(msg proto.Message) bool { - events := s.ctx.EventManager().Events().ToABCIEvents() +func (s HandlerTestSuite) containsMessage(result *sdk.Result, msg proto.Message) bool { + events := result.GetEvents().ToABCIEvents() for _, event := range events { typeEvent, _ := sdk.ParseTypedEvent(event) if assert.ObjectsAreEqual(msg, typeEvent) { @@ -89,13 +89,13 @@ func (s HandlerTestSuite) containsMessage(msg proto.Message) bool { func (s HandlerTestSuite) runTests(cases []CommonTest) { for _, tc := range cases { s.T().Run(tc.name, func(t *testing.T) { - _, err := s.handler(s.ctx, tc.msg) + response, err := s.handler(s.ctx, tc.msg) if len(tc.errorMsg) > 0 { assert.EqualError(t, err, tc.errorMsg) } else { if tc.expectedEvent != nil { - result := s.containsMessage(tc.expectedEvent) + result := s.containsMessage(response, tc.expectedEvent) s.True(result, fmt.Sprintf("Expected typed event was not found: %v", tc.expectedEvent)) } diff --git a/x/marker/handler_test.go b/x/marker/handler_test.go index aa9f87d5e3..94a9669dac 100644 --- a/x/marker/handler_test.go +++ b/x/marker/handler_test.go @@ -81,8 +81,8 @@ func TestInvalidProposal(t *testing.T) { require.True(t, strings.Contains(err.Error(), "unrecognized marker proposal content type: *types.TextProposal")) } -func (s HandlerTestSuite) containsMessage(msg proto.Message) bool { - events := s.ctx.EventManager().Events().ToABCIEvents() +func (s HandlerTestSuite) containsMessage(result *sdk.Result, msg proto.Message) bool { + events := result.GetEvents().ToABCIEvents() for _, event := range events { typeEvent, _ := sdk.ParseTypedEvent(event) if assert.ObjectsAreEqual(msg, typeEvent) { @@ -103,13 +103,13 @@ type CommonTest struct { func (s HandlerTestSuite) runTests(cases []CommonTest) { for _, tc := range cases { s.T().Run(tc.name, func(t *testing.T) { - _, err := s.handler(s.ctx, tc.msg) + response, err := s.handler(s.ctx, tc.msg) if len(tc.errorMsg) > 0 { assert.EqualError(t, err, tc.errorMsg) } else { if tc.expectedEvent != nil { - result := s.containsMessage(tc.expectedEvent) + result := s.containsMessage(response, tc.expectedEvent) s.True(result, fmt.Sprintf("Expected typed event was not found: %v", tc.expectedEvent)) } diff --git a/x/name/handler_test.go b/x/name/handler_test.go index 1c13e9c4a8..4567086dbd 100644 --- a/x/name/handler_test.go +++ b/x/name/handler_test.go @@ -64,7 +64,7 @@ func TestCreateName(t *testing.T) { accs := authtypes.GenesisAccounts{acc1} app := simapp.SetupWithGenesisAccounts(accs) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - em := ctx.EventManager() + var nameData nametypes.GenesisState nameData.Bindings = append(nameData.Bindings, nametypes.NewNameRecord("name", addr1, false)) nameData.Bindings = append(nameData.Bindings, nametypes.NewNameRecord("example.name", addr1, false)) @@ -80,15 +80,15 @@ func TestCreateName(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - _, err := handler(ctx, tc.msg) + response, err := handler(ctx, tc.msg) if tc.expectedError != nil { require.EqualError(t, err, tc.expectedError.Error()) } else { require.NoError(t, err) } if tc.expectedEvent != nil { - require.Equal(t, 1, len(em.Events().ToABCIEvents())) - msg1, _ := sdk.ParseTypedEvent(em.Events().ToABCIEvents()[0]) + require.Equal(t, 1, len(response.GetEvents().ToABCIEvents())) + msg1, _ := sdk.ParseTypedEvent(response.GetEvents().ToABCIEvents()[0]) require.Equal(t, tc.expectedEvent, msg1) } }) @@ -128,7 +128,7 @@ func TestDeleteName(t *testing.T) { accs := authtypes.GenesisAccounts{acc1} app := simapp.SetupWithGenesisAccounts(accs) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - em := ctx.EventManager() + var nameData nametypes.GenesisState nameData.Bindings = append(nameData.Bindings, nametypes.NewNameRecord("name", addr1, false)) nameData.Bindings = append(nameData.Bindings, nametypes.NewNameRecord("example.name", addr1, false)) @@ -144,15 +144,15 @@ func TestDeleteName(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - _, err := handler(ctx, tc.msg) + response, err := handler(ctx, tc.msg) if tc.expectedError != nil { require.EqualError(t, err, tc.expectedError.Error()) } else { require.NoError(t, err) } if tc.expectedEvent != nil { - require.Equal(t, 1, len(em.Events().ToABCIEvents())) - msg1, _ := sdk.ParseTypedEvent(em.Events().ToABCIEvents()[0]) + require.Equal(t, 1, len(response.GetEvents().ToABCIEvents())) + msg1, _ := sdk.ParseTypedEvent(response.GetEvents().ToABCIEvents()[0]) require.Equal(t, tc.expectedEvent, msg1) } })