@@ -40,59 +40,6 @@ import (
4040)
4141
4242func TestIBCQuerier (t * testing.T ) {
43- myExampleChannels := []channeltypes.IdentifiedChannel {
44- // this is returned
45- {
46- State : channeltypes .OPEN ,
47- Ordering : channeltypes .ORDERED ,
48- Counterparty : channeltypes.Counterparty {
49- PortId : "counterPartyPortID" ,
50- ChannelId : "counterPartyChannelID" ,
51- },
52- ConnectionHops : []string {"one" },
53- Version : "v1" ,
54- PortId : "myPortID" ,
55- ChannelId : "myChannelID" ,
56- },
57- // this is filtered out
58- {
59- State : channeltypes .INIT ,
60- Ordering : channeltypes .UNORDERED ,
61- Counterparty : channeltypes.Counterparty {
62- PortId : "foobar" ,
63- },
64- ConnectionHops : []string {"one" },
65- Version : "initversion" ,
66- PortId : "initPortID" ,
67- ChannelId : "initChannelID" ,
68- },
69- // this is returned
70- {
71- State : channeltypes .OPEN ,
72- Ordering : channeltypes .UNORDERED ,
73- Counterparty : channeltypes.Counterparty {
74- PortId : "otherCounterPartyPortID" ,
75- ChannelId : "otherCounterPartyChannelID" ,
76- },
77- ConnectionHops : []string {"other" , "second" },
78- Version : "otherVersion" ,
79- PortId : "otherPortID" ,
80- ChannelId : "otherChannelID" ,
81- },
82- // this is filtered out
83- {
84- State : channeltypes .CLOSED ,
85- Ordering : channeltypes .ORDERED ,
86- Counterparty : channeltypes.Counterparty {
87- PortId : "super" ,
88- ChannelId : "duper" ,
89- },
90- ConnectionHops : []string {"no-more" },
91- Version : "closedVersion" ,
92- PortId : "closedPortID" ,
93- ChannelId : "closedChannelID" ,
94- },
95- }
9643 specs := map [string ]struct {
9744 srcQuery * wasmvmtypes.IBCQuery
9845 wasmKeeper * mockWasmQueryKeeper
@@ -112,82 +59,6 @@ func TestIBCQuerier(t *testing.T) {
11259 channelKeeper : & wasmtesting.MockChannelKeeper {},
11360 expJSONResult : `{"port_id":"myIBCPortID"}` ,
11461 },
115- "query list channels - all" : {
116- srcQuery : & wasmvmtypes.IBCQuery {
117- ListChannels : & wasmvmtypes.ListChannelsQuery {},
118- },
119- channelKeeper : & wasmtesting.MockChannelKeeper {
120- IterateChannelsFn : wasmtesting .MockChannelKeeperIterator (myExampleChannels ),
121- },
122- expJSONResult : `{
123- "channels": [
124- {
125- "endpoint": {
126- "port_id": "myPortID",
127- "channel_id": "myChannelID"
128- },
129- "counterparty_endpoint": {
130- "port_id": "counterPartyPortID",
131- "channel_id": "counterPartyChannelID"
132- },
133- "order": "ORDER_ORDERED",
134- "version": "v1",
135- "connection_id": "one"
136- },
137- {
138- "endpoint": {
139- "port_id": "otherPortID",
140- "channel_id": "otherChannelID"
141- },
142- "counterparty_endpoint": {
143- "port_id": "otherCounterPartyPortID",
144- "channel_id": "otherCounterPartyChannelID"
145- },
146- "order": "ORDER_UNORDERED",
147- "version": "otherVersion",
148- "connection_id": "other"
149- }
150- ]
151- }` ,
152- },
153- "query list channels - filtered" : {
154- srcQuery : & wasmvmtypes.IBCQuery {
155- ListChannels : & wasmvmtypes.ListChannelsQuery {
156- PortID : "otherPortID" ,
157- },
158- },
159- channelKeeper : & wasmtesting.MockChannelKeeper {
160- IterateChannelsFn : wasmtesting .MockChannelKeeperIterator (myExampleChannels ),
161- },
162- expJSONResult : `{
163- "channels": [
164- {
165- "endpoint": {
166- "port_id": "otherPortID",
167- "channel_id": "otherChannelID"
168- },
169- "counterparty_endpoint": {
170- "port_id": "otherCounterPartyPortID",
171- "channel_id": "otherCounterPartyChannelID"
172- },
173- "order": "ORDER_UNORDERED",
174- "version": "otherVersion",
175- "connection_id": "other"
176- }
177- ]
178- }` ,
179- },
180- "query list channels - filtered empty" : {
181- srcQuery : & wasmvmtypes.IBCQuery {
182- ListChannels : & wasmvmtypes.ListChannelsQuery {
183- PortID : "none-existing" ,
184- },
185- },
186- channelKeeper : & wasmtesting.MockChannelKeeper {
187- IterateChannelsFn : wasmtesting .MockChannelKeeperIterator (myExampleChannels ),
188- },
189- expJSONResult : `{"channels": []}` ,
190- },
19162 "query channel" : {
19263 srcQuery : & wasmvmtypes.IBCQuery {
19364 Channel : & wasmvmtypes.ChannelQuery {
0 commit comments