MCPcopy
hub / github.com/ory/keto / queryTupleErr

Method queryTupleErr

internal/e2e/rest_client_test.go:111–128  ·  view source on GitHub ↗
(t testing.TB, expected herodot.DefaultError, q *ketoapi.RelationQuery, opts ...paginationOptionSetter)

Source from the content-addressed store, hash-verified

109}
110
111func (rc *restClient) queryTupleErr(t testing.TB, expected herodot.DefaultError, q *ketoapi.RelationQuery, opts ...paginationOptionSetter) {
112 urlQuery := q.ToURLQuery()
113
114 pagination := getPaginationOptions(opts...)
115 if pagination.Size != 0 {
116 urlQuery.Set("page_size", strconv.Itoa(pagination.Size))
117 }
118 if pagination.Token != "" {
119 urlQuery.Set("page_token", pagination.Token)
120 }
121
122 body, code := rc.makeRequest(t, http.MethodGet, fmt.Sprintf("%s?%s", relationtuple.ReadRouteBase, urlQuery.Encode()), "", rc.readURL)
123
124 assert.Equal(t, expected.CodeField, code)
125 assert.Equal(t, int64(expected.StatusCode()), gjson.Get(body, "error.code").Int())
126 assert.Equal(t, expected.Status(), gjson.Get(body, "error.status").String())
127 assert.Equal(t, expected.Error(), gjson.Get(body, "error.message").String(), body)
128}
129
130func (rc *restClient) check(t testing.TB, r *ketoapi.RelationTuple) bool {
131 q := r.ToURLQuery()

Callers

nothing calls this directly

Calls 10

makeRequestMethod · 0.95
getPaginationOptionsFunction · 0.85
StatusCodeMethod · 0.80
StatusMethod · 0.65
StringMethod · 0.65
ToURLQueryMethod · 0.45
SetMethod · 0.45
EncodeMethod · 0.45
GetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected