Skip to content

Commit ac8e0f4

Browse files
committed
test(logic): improve test coverage for predicate blacklisting
1 parent 15e6121 commit ac8e0f4

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

x/logic/keeper/grpc_query_ask_test.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,29 @@ func TestGRPCAsk(t *testing.T) {
239239
expectedAnswer: &types.Answer{
240240
HasMore: false,
241241
Variables: []string{"X"},
242-
Results: []types.Result{{Error: "error(permission_error(execute,forbidden_predicate,block_height/1),block_height/1)"}},
242+
Results: []types.Result{{Error: "error(permission_error(execute,forbidden_predicate,block_height/1),root)"}},
243+
},
244+
},
245+
{
246+
program: "contains_forbidden_predicate(X) :- block_height(X).",
247+
query: "contains_forbidden_predicate(X).",
248+
predicateBlacklist: []string{"block_height/1"},
249+
expectedAnswer: &types.Answer{
250+
HasMore: false,
251+
Variables: []string{"X"},
252+
Results: []types.Result{{Error: "error(permission_error(execute,forbidden_predicate,block_height/1),contains_forbidden_predicate/1)"}},
253+
},
254+
},
255+
{
256+
program: "cannot_be_blacklisted(X) :- X = 42.",
257+
query: "cannot_be_blacklisted(X).",
258+
predicateBlacklist: []string{"cant_be_blacklisted/1"},
259+
expectedAnswer: &types.Answer{
260+
HasMore: false,
261+
Variables: []string{"X"},
262+
Results: []types.Result{{Substitutions: []types.Substitution{{
263+
Variable: "X", Expression: "42",
264+
}}}},
243265
},
244266
},
245267
{

0 commit comments

Comments
 (0)