14
14
TransportServerError ,
15
15
)
16
16
17
- from .conftest import TemporaryFile
17
+ from .conftest import TemporaryFile , strip_braces_spaces
18
18
19
19
query1_str = """
20
20
query getContinents {
@@ -588,15 +588,15 @@ def test_code():
588
588
589
589
file_upload_mutation_1 = """
590
590
mutation($file: Upload!) {
591
- uploadFile(input:{ other_var:$other_var, file:$file }) {
591
+ uploadFile(input:{other_var:$other_var, file:$file}) {
592
592
success
593
593
}
594
594
}
595
595
"""
596
596
597
597
file_upload_mutation_1_operations = (
598
- '{"query": "mutation ($file: Upload!) {\\ n uploadFile(input: { other_var: '
599
- '$other_var, file: $file }) {\\ n success\\ n }\\ n}", "variables": '
598
+ '{"query": "mutation ($file: Upload!) {\\ n uploadFile(input: {other_var: '
599
+ '$other_var, file: $file}) {\\ n success\\ n }\\ n}", "variables": '
600
600
'{"file": null, "other_var": 42}}'
601
601
)
602
602
@@ -617,7 +617,7 @@ async def single_upload_handler(request):
617
617
field_0 = await reader .next ()
618
618
assert field_0 .name == "operations"
619
619
field_0_text = await field_0 .text ()
620
- assert field_0_text == file_upload_mutation_1_operations
620
+ assert strip_braces_spaces ( field_0_text ) == file_upload_mutation_1_operations
621
621
622
622
field_1 = await reader .next ()
623
623
assert field_1 .name == "map"
@@ -679,7 +679,7 @@ async def single_upload_handler_with_content_type(request):
679
679
field_0 = await reader .next ()
680
680
assert field_0 .name == "operations"
681
681
field_0_text = await field_0 .text ()
682
- assert field_0_text == file_upload_mutation_1_operations
682
+ assert strip_braces_spaces ( field_0_text ) == file_upload_mutation_1_operations
683
683
684
684
field_1 = await reader .next ()
685
685
assert field_1 .name == "map"
@@ -790,7 +790,7 @@ async def binary_upload_handler(request):
790
790
field_0 = await reader .next ()
791
791
assert field_0 .name == "operations"
792
792
field_0_text = await field_0 .text ()
793
- assert field_0_text == file_upload_mutation_1_operations
793
+ assert strip_braces_spaces ( field_0_text ) == file_upload_mutation_1_operations
794
794
795
795
field_1 = await reader .next ()
796
796
assert field_1 .name == "map"
@@ -931,7 +931,7 @@ async def file_sender(file_name):
931
931
932
932
file_upload_mutation_2_operations = (
933
933
'{"query": "mutation ($file1: Upload!, $file2: Upload!) {\\ n '
934
- 'uploadFile(input: { file1: $file, file2: $file }) {\\ n success\\ n }\\ n}", '
934
+ 'uploadFile(input: {file1: $file, file2: $file}) {\\ n success\\ n }\\ n}", '
935
935
'"variables": {"file1": null, "file2": null}}'
936
936
)
937
937
@@ -955,7 +955,7 @@ async def handler(request):
955
955
field_0 = await reader .next ()
956
956
assert field_0 .name == "operations"
957
957
field_0_text = await field_0 .text ()
958
- assert field_0_text == file_upload_mutation_2_operations
958
+ assert strip_braces_spaces ( field_0_text ) == file_upload_mutation_2_operations
959
959
960
960
field_1 = await reader .next ()
961
961
assert field_1 .name == "map"
@@ -1019,15 +1019,15 @@ async def handler(request):
1019
1019
1020
1020
file_upload_mutation_3 = """
1021
1021
mutation($files: [Upload!]!) {
1022
- uploadFiles(input:{ files:$files }) {
1022
+ uploadFiles(input:{files:$files}) {
1023
1023
success
1024
1024
}
1025
1025
}
1026
1026
"""
1027
1027
1028
1028
file_upload_mutation_3_operations = (
1029
1029
'{"query": "mutation ($files: [Upload!]!) {\\ n uploadFiles('
1030
- "input: { files: $files })"
1030
+ "input: {files: $files})"
1031
1031
' {\\ n success\\ n }\\ n}", "variables": {"files": [null, null]}}'
1032
1032
)
1033
1033
@@ -1046,7 +1046,7 @@ async def handler(request):
1046
1046
field_0 = await reader .next ()
1047
1047
assert field_0 .name == "operations"
1048
1048
field_0_text = await field_0 .text ()
1049
- assert field_0_text == file_upload_mutation_3_operations
1049
+ assert strip_braces_spaces ( field_0_text ) == file_upload_mutation_3_operations
1050
1050
1051
1051
field_1 = await reader .next ()
1052
1052
assert field_1 .name == "map"
0 commit comments