File tree Expand file tree Collapse file tree 2 files changed +39
-30
lines changed Expand file tree Collapse file tree 2 files changed +39
-30
lines changed Original file line number Diff line number Diff line change 99
1010__all__ = [
1111 "test_schema" ,
12- "empty_schema" ,
1312 "assert_validation_errors" ,
1413 "assert_sdl_validation_errors" ,
1514]
134133 complicatedArgs: ComplicatedArgs
135134 }
136135
137- type Message {
138- body: String
139- sender: String
140- }
141-
142- type SubscriptionRoot {
143- importantEmails: [String]
144- notImportantEmails: [String]
145- moreImportantEmails: [String]
146- spamEmails: [String]
147- deletedEmails: [String]
148- newMessage: Message
149- }
150-
151136 schema {
152137 query: QueryRoot
153- subscription: SubscriptionRoot
154138 }
155139
156140 directive @onQuery on QUERY
164148 """
165149)
166150
167- empty_schema = build_schema (
168- """
169- type QueryRoot {
170- empty: Boolean
171- }
172-
173- schema {
174- query: QueryRoot
175- }
176- """
177- )
178-
179151
180152def assert_validation_errors (
181153 rule : Type [ValidationRule ],
Original file line number Diff line number Diff line change 11from functools import partial
22
3+ from graphql .utilities import build_schema
34from graphql .validation import SingleFieldSubscriptionsRule
45
5- from .harness import assert_validation_errors , empty_schema
6+ from .harness import assert_validation_errors
67
7- assert_errors = partial (assert_validation_errors , SingleFieldSubscriptionsRule )
8+ schema = build_schema (
9+ """
10+ type Message {
11+ body: String
12+ sender: String
13+ }
14+
15+ type SubscriptionRoot {
16+ importantEmails: [String]
17+ notImportantEmails: [String]
18+ moreImportantEmails: [String]
19+ spamEmails: [String]
20+ deletedEmails: [String]
21+ newMessage: Message
22+ }
23+
24+ type QueryRoot {
25+ dummy: String
26+ }
27+
28+ schema {
29+ query: QueryRoot
30+ subscription: SubscriptionRoot
31+ }
32+ """
33+ )
34+
35+ assert_errors = partial (
36+ assert_validation_errors , SingleFieldSubscriptionsRule , schema = schema
37+ )
838
939assert_valid = partial (assert_errors , errors = [])
1040
@@ -262,6 +292,13 @@ def fails_with_introspection_field_in_anonymous_subscription():
262292 )
263293
264294 def skips_if_not_subscription_type ():
295+ empty_schema = build_schema (
296+ """
297+ type Query {
298+ dummy: String
299+ }
300+ """
301+ )
265302 assert_errors (
266303 """
267304 subscription {
You can’t perform that action at this time.
0 commit comments