def assert_validation_errors( rule: Type[ValidationRule], query_str: str, errors: List[GraphQLError], schema: GraphQLSchema = test_schema, ) -> List[GraphQLError]: doc = parse(query_str) returned_errors = validate(schema, doc, [rule]) assert returned_errors == errors return returned_errors
def expect_invalid(schema, rule, query_string, expected_errors, **options): errors = validate(schema, parse(query_string, **options), [rule]) assert errors, "Should not validate" assert errors == expected_errors return errors
def expect_valid(schema, rule, query_string, **options): errors = validate(schema, parse(query_string, **options), [rule]) assert errors == [], "Should validate"