types/rest: add unit tests (#5779)

* types/rest: add unit tests

Drop unused functions:
- ParseQueryParamBool()
- ParseInt64OrReturnBadRequest()

* Fix test

* Disable parallelism

* Reintroduce @fedekunze ParseQueryParamBool

* Don't count Name() calls to fix flaky tests
This commit is contained in:
Alessio Treglia
2020-03-10 18:53:25 +00:00
committed by GitHub
parent c0a8b2582a
commit 2de4775a25
4 changed files with 175 additions and 24 deletions
+2 -2
View File
@@ -32,8 +32,8 @@ func TestBasicManager(t *testing.T) {
mockAppModuleBasic1 := mocks.NewMockAppModuleBasic(mockCtrl)
mockAppModuleBasic2 := mocks.NewMockAppModuleBasic(mockCtrl)
mockAppModuleBasic1.EXPECT().Name().Times(3).Return("mockAppModuleBasic1")
mockAppModuleBasic2.EXPECT().Name().Times(2).Return("mockAppModuleBasic2")
mockAppModuleBasic1.EXPECT().Name().AnyTimes().Return("mockAppModuleBasic1")
mockAppModuleBasic2.EXPECT().Name().AnyTimes().Return("mockAppModuleBasic2")
mockAppModuleBasic1.EXPECT().DefaultGenesis(gomock.Eq(cdc)).Times(1).Return(json.RawMessage(``))
mockAppModuleBasic2.EXPECT().DefaultGenesis(gomock.Eq(cdc)).Times(1).Return(json.RawMessage(`{"key":"value"}`))
mockAppModuleBasic1.EXPECT().ValidateGenesis(gomock.Eq(cdc), gomock.Eq(wantDefaultGenesis["mockAppModuleBasic1"])).Times(1).Return(errFoo)