Skip to content

Commit 9dc7f26

Browse files
committed
Added preflight request tests
1 parent 60634ef commit 9dc7f26

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/test_graphqlview.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ def test_batch_supports_post_json_query_with_json_variables(app):
547547
assert response_json(response) == [{
548548
'data': {'test': "Hello Dolly"},
549549
}]
550-
551-
550+
551+
552552
@parametrize_sync_async_app_test('app', batch=True)
553553
def test_batch_allows_post_with_operation_name(app):
554554
_, response = app.client.post(
@@ -588,3 +588,22 @@ def test_async_schema(app):
588588
'a': 'hey', 'b': 'hey2', 'c': 'hey3'
589589
}
590590
}
591+
592+
593+
@parametrize_sync_async_app_test('app')
594+
def test_preflight_request(app):
595+
_, response = app.client.options(uri=url_string(), headers={
596+
'Access-Control-Request-Method': 'POST',
597+
})
598+
599+
assert response.status == 200
600+
601+
602+
@parametrize_sync_async_app_test('app')
603+
def test_preflight_incorrect_request(app):
604+
_, response = app.client.options(uri=url_string(), headers={
605+
'Access-Control-Request-Method': 'OPTIONS',
606+
})
607+
608+
assert response.status == 400
609+

0 commit comments

Comments
 (0)