Generalized django.testing.file_graphql_query to other frameworks than Django
Background
Although graphene_file_upload.django.testing.file_graphql_query is imported in the example of testing for flask, as metioned in issue #59 , file_graphql_query depends on Django for using django.testing.Client as default argument.
However, it seems almost all codes in file_graphql_query are not specialized for Django. The only point tightly coupled with Django is the argument structure of django.testing.Client.post method.
Test client of other frameworks, such as flask.testing.FlaskClient or fastapi.testclinet.TestClient, also has post method, but their argument is slightly different from Django's one.
Examples of differences are below.
In Django data is a positional argument but in Flask data is a keyword argument.
In Django and Flask, files should be contain data argument, but in FastApi files is separated argument (Not client.post("/graphql", data=data) but client.post("/graphql", data=data, files=files) works)
It would be useful to modify file_graphql_query to be able to absorb framework's test client differences.
Implements
All logics in file_graphql_query which are not coupled with Django ara moved into, testingbase.py, and client argument is changed into client_post argument. client_post argument is a function that abstracts post method of each frameworks' test client post methods. It receives endpoint, data, files, and headers.
And testing.py for each frameworks(in /graphene_file_upload/django/testing and /graphene_file_upload/flask/testing) implements client_post using framework specific test client. I only implemented for only Django and Flask, but testingbase.file_graphql_query can be applicable for any other frameworks such as FastAPI.
Generalized django.testing.file_graphql_query to other frameworks than Django
Background
Although graphene_file_upload.django.testing.file_graphql_query is imported in the example of testing for flask, as metioned in issue #59 , file_graphql_query depends on Django for using django.testing.Client as default argument. However, it seems almost all codes in file_graphql_query are not specialized for Django. The only point tightly coupled with Django is the argument structure of django.testing.Client.post method. Test client of other frameworks, such as flask.testing.FlaskClient or fastapi.testclinet.TestClient, also has post method, but their argument is slightly different from Django's one. Examples of differences are below.
Implements
All logics in file_graphql_query which are not coupled with Django ara moved into, testingbase.py, and client argument is changed into client_post argument. client_post argument is a function that abstracts post method of each frameworks' test client post methods. It receives endpoint, data, files, and headers. And testing.py for each frameworks(in /graphene_file_upload/django/testing and /graphene_file_upload/flask/testing) implements client_post using framework specific test client. I only implemented for only Django and Flask, but testingbase.file_graphql_query can be applicable for any other frameworks such as FastAPI.