From f78e6b5c1854cb3ef3cb3b6abd42618c0c901685 Mon Sep 17 00:00:00 2001 From: Rob De Feo Date: Sat, 20 Feb 2021 14:01:24 +0000 Subject: [PATCH] test: fix protocols api test --- .../internal/http/handlers/protocols_test.go | 27 ++++++++++++++++++- .../response-200-default-algorand.json | 27 +++++++++++++++++++ ...um.json => response-200-disabled-all.json} | 0 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-default-algorand.json rename cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/{response-200-disabled-ethereum.json => response-200-disabled-all.json} (100%) diff --git a/cmd/mailchain/internal/http/handlers/protocols_test.go b/cmd/mailchain/internal/http/handlers/protocols_test.go index 5969adf4d..043ebcb8d 100644 --- a/cmd/mailchain/internal/http/handlers/protocols_test.go +++ b/cmd/mailchain/internal/http/handlers/protocols_test.go @@ -39,7 +39,7 @@ func TestGetProtocols(t *testing.T) { wantStatus int }{ { - "200-disabled-ethereum", + "200-disabled-all", args{ func() *settings.Root { m := valuestest.NewMockStore(mockCtrl) @@ -47,6 +47,8 @@ func TestGetProtocols(t *testing.T) { 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) }(), @@ -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) }(), @@ -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) }(), @@ -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) }(), @@ -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) }(), diff --git a/cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-default-algorand.json b/cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-default-algorand.json new file mode 100644 index 000000000..fcc6ee410 --- /dev/null +++ b/cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-default-algorand.json @@ -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 + } + ] + } + ] +} \ No newline at end of file diff --git a/cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-disabled-ethereum.json b/cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-disabled-all.json similarity index 100% rename from cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-disabled-ethereum.json rename to cmd/mailchain/internal/http/handlers/testdata/TestGetProtocols/response-200-disabled-all.json