Skip to content

Commit

Permalink
test: fix protocols api test
Browse files Browse the repository at this point in the history
  • Loading branch information
robdefeo committed Feb 20, 2021
1 parent 8df4b74 commit f78e6b5
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
27 changes: 26 additions & 1 deletion cmd/mailchain/internal/http/handlers/protocols_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ func TestGetProtocols(t *testing.T) {
wantStatus int
}{
{
"200-disabled-ethereum",
"200-disabled-all",
args{
func() *settings.Root {
m := valuestest.NewMockStore(mockCtrl)
m.EXPECT().IsSet("protocols.ethereum.disabled").Return(true)
m.EXPECT().GetBool("protocols.ethereum.disabled").Return(true)
m.EXPECT().IsSet("protocols.substrate.disabled").Return(true)
m.EXPECT().GetBool("protocols.substrate.disabled").Return(true)
m.EXPECT().IsSet("protocols.algorand.disabled").Return(true)
m.EXPECT().GetBool("protocols.algorand.disabled").Return(true)
m.EXPECT().IsSet(gomock.Any()).Return(false).AnyTimes()
return settings.FromStore(m)
}(),
Expand All @@ -62,6 +64,8 @@ func TestGetProtocols(t *testing.T) {
m.EXPECT().GetBool("protocols.ethereum.networks.goerli.disabled").Return(true)
m.EXPECT().IsSet("protocols.substrate.disabled").Return(true)
m.EXPECT().GetBool("protocols.substrate.disabled").Return(true)
m.EXPECT().IsSet("protocols.algorand.disabled").Return(true)
m.EXPECT().GetBool("protocols.algorand.disabled").Return(true)
m.EXPECT().IsSet(gomock.Any()).Return(false).AnyTimes()
return settings.FromStore(m)
}(),
Expand All @@ -77,6 +81,8 @@ func TestGetProtocols(t *testing.T) {
m.EXPECT().GetString("protocols.ethereum.networks.goerli.nameservice-address").Return("")
m.EXPECT().IsSet("protocols.substrate.disabled").Return(true)
m.EXPECT().GetBool("protocols.substrate.disabled").Return(true)
m.EXPECT().IsSet("protocols.algorand.disabled").Return(true)
m.EXPECT().GetBool("protocols.algorand.disabled").Return(true)
m.EXPECT().IsSet(gomock.Any()).Return(false).AnyTimes()
return settings.FromStore(m)
}(),
Expand All @@ -90,6 +96,8 @@ func TestGetProtocols(t *testing.T) {
m := valuestest.NewMockStore(mockCtrl)
m.EXPECT().IsSet("protocols.substrate.disabled").Return(true)
m.EXPECT().GetBool("protocols.substrate.disabled").Return(true)
m.EXPECT().IsSet("protocols.algorand.disabled").Return(true)
m.EXPECT().GetBool("protocols.algorand.disabled").Return(true)
m.EXPECT().IsSet(gomock.Any()).Return(false).AnyTimes()
return settings.FromStore(m)
}(),
Expand All @@ -103,6 +111,23 @@ func TestGetProtocols(t *testing.T) {
m := valuestest.NewMockStore(mockCtrl)
m.EXPECT().IsSet("protocols.ethereum.disabled").Return(true)
m.EXPECT().GetBool("protocols.ethereum.disabled").Return(true)
m.EXPECT().IsSet("protocols.algorand.disabled").Return(true)
m.EXPECT().GetBool("protocols.algorand.disabled").Return(true)
m.EXPECT().IsSet(gomock.Any()).Return(false).AnyTimes()
return settings.FromStore(m)
}(),
},
http.StatusOK,
},
{
"200-default-algorand",
args{
func() *settings.Root {
m := valuestest.NewMockStore(mockCtrl)
m.EXPECT().IsSet("protocols.ethereum.disabled").Return(true)
m.EXPECT().GetBool("protocols.ethereum.disabled").Return(true)
m.EXPECT().IsSet("protocols.substrate.disabled").Return(true)
m.EXPECT().GetBool("protocols.substrate.disabled").Return(true)
m.EXPECT().IsSet(gomock.Any()).Return(false).AnyTimes()
return settings.FromStore(m)
}(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"protocols": [
{
"name": "algorand",
"networks": [
{
"name": "betanet",
"id": "",
"nameservice-domain-enabled": false,
"nameservice-address-enabled": false
},
{
"name": "mainnet",
"id": "",
"nameservice-domain-enabled": false,
"nameservice-address-enabled": false
},
{
"name": "testnet",
"id": "",
"nameservice-domain-enabled": false,
"nameservice-address-enabled": false
}
]
}
]
}

0 comments on commit f78e6b5

Please sign in to comment.