MCPcopy Create free account
hub / github.com/NextDotID/proof_server / Test_proofQuery

Function Test_proofQuery

controller/proof_query_test.go:128–272  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

126}
127
128func Test_proofQuery(t *testing.T) {
129 t.Run("smoke", func(t *testing.T) {
130 before_each(t)
131 resp := ProofQueryResponse{}
132
133 APITestCall(Engine, "GET", "/v1/proof?platform=twitter&identity=yeiwb", "", &resp)
134 require.Equal(t, 0, len(resp.IDs))
135 })
136
137 t.Run("success", func(t *testing.T) {
138 before_each(t)
139 insert_proof(t)
140
141 resp := ProofQueryResponse{}
142 APITestCall(Engine, "GET", "/v1/proof?platform=twitter&identity=yeiwb", "", &resp)
143 require.Equal(t, 1, len(resp.IDs))
144 found := resp.IDs[0]
145 require.Equal(t, persona, found.Persona)
146 require.Equal(t, persona, found.Avatar)
147 require.Equal(t, 2, len(found.Proofs))
148 require.Equal(t, 0, resp.Pagination.Next)
149 require.Equal(t, int64(1), resp.Pagination.Total)
150 require.Equal(t, 1, resp.Pagination.Current)
151 require.Equal(t, PER_PAGE, resp.Pagination.Per)
152 require.NotEqual(t, "0", found.ActivatedAt)
153 require.NotEqual(t, "", found.ActivatedAt)
154
155 partial_resp := ProofQueryResponse{}
156 APITestCall(Engine, "GET", "/v1/proof?platform=twitter&identity=eiw", "", &partial_resp)
157 require.Equal(t, 1, len(resp.IDs))
158 found = partial_resp.IDs[0]
159 require.Equal(t, persona, found.Persona)
160 require.Equal(t, persona, found.Avatar)
161 require.Equal(t, 2, len(found.Proofs))
162
163 empty_resp := ProofQueryResponse{}
164 APITestCall(Engine, "GET", "/v1/proof?platform=keybase&identity=yeiwb", "", &empty_resp)
165 require.Equal(t, 0, len(empty_resp.IDs))
166 })
167
168 t.Run("all platform result", func(t *testing.T) {
169 before_each(t)
170 insert_proof(t)
171
172 resp := ProofQueryResponse{}
173 APITestCall(Engine, "GET", "/v1/proof?identity=eiwb", "", &resp)
174 require.Equal(t, 1, len(resp.IDs))
175 found := resp.IDs[0]
176 require.Equal(t, persona, found.Persona)
177 require.Equal(t, persona, found.Avatar)
178 require.Equal(t, 2, len(found.Proofs))
179 })
180
181 t.Run("multiple identity + fuzzy", func(t *testing.T) {
182 before_each(t)
183 insert_proof(t)
184
185 resp := ProofQueryResponse{}

Callers

nothing calls this directly

Calls 7

GenerateKeypairFunction · 0.92
PlatformTypeAlias · 0.92
insert_proofFunction · 0.85
insert_eth_proofFunction · 0.85
insert_proof_exactFunction · 0.85
before_eachFunction · 0.70
APITestCallFunction · 0.70

Tested by

no test coverage detected