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 9
9
10
10
__all__ = [
11
11
"test_schema" ,
12
- "empty_schema" ,
13
12
"assert_validation_errors" ,
14
13
"assert_sdl_validation_errors" ,
15
14
]
134
133
complicatedArgs: ComplicatedArgs
135
134
}
136
135
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
-
151
136
schema {
152
137
query: QueryRoot
153
- subscription: SubscriptionRoot
154
138
}
155
139
156
140
directive @onQuery on QUERY
164
148
"""
165
149
)
166
150
167
- empty_schema = build_schema (
168
- """
169
- type QueryRoot {
170
- empty: Boolean
171
- }
172
-
173
- schema {
174
- query: QueryRoot
175
- }
176
- """
177
- )
178
-
179
151
180
152
def assert_validation_errors (
181
153
rule : Type [ValidationRule ],
Original file line number Diff line number Diff line change 1
1
from functools import partial
2
2
3
+ from graphql .utilities import build_schema
3
4
from graphql .validation import SingleFieldSubscriptionsRule
4
5
5
- from .harness import assert_validation_errors , empty_schema
6
+ from .harness import assert_validation_errors
6
7
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
+ )
8
38
9
39
assert_valid = partial (assert_errors , errors = [])
10
40
@@ -262,6 +292,13 @@ def fails_with_introspection_field_in_anonymous_subscription():
262
292
)
263
293
264
294
def skips_if_not_subscription_type ():
295
+ empty_schema = build_schema (
296
+ """
297
+ type Query {
298
+ dummy: String
299
+ }
300
+ """
301
+ )
265
302
assert_errors (
266
303
"""
267
304
subscription {
You can’t perform that action at this time.
0 commit comments