-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
2,767 additions
and
1,486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,66 @@ | ||
from graphql import ResolveInfo | ||
|
||
from .types.fields import Field, Integer, Float, String, Boolean, ID, JsonString, DateTime, Date, Time | ||
from .resolution import ( | ||
Resolver, | ||
ResolveArgs, | ||
PartialResolver, | ||
Selection, | ||
ResolveInfo, | ||
FilterExpression, | ||
FilterOperator, | ||
) | ||
from .types.fields import ( | ||
Field, | ||
Integer, | ||
Float, | ||
String, | ||
Boolean, | ||
ID, | ||
JsonString, | ||
DateTime, | ||
Date, | ||
Time, | ||
) | ||
from .types import BaseType, Object, Enum, EnumValue, Union | ||
from .schema import Schema | ||
from .operation import Operation, InvalidOperation | ||
from .query import gql, ExecutionResult | ||
|
||
__all__ = ( | ||
# graphql | ||
'ResolveInfo', | ||
|
||
# resolution | ||
"Resolver", | ||
"PartialResolver", | ||
"ResolveArgs", | ||
"Selection", | ||
"ResolveInfo", | ||
"FilterExpression", | ||
"FilterOperator", | ||
# fields | ||
'Field', | ||
'Integer', | ||
'Float', | ||
'String', | ||
'Boolean', | ||
'ID', | ||
'JsonString', | ||
'DateTime', | ||
'Date', | ||
'Time', | ||
|
||
"Field", | ||
"Integer", | ||
"Float", | ||
"String", | ||
"Boolean", | ||
"ID", | ||
"JsonString", | ||
"DateTime", | ||
"Date", | ||
"Time", | ||
# types | ||
'BaseType', | ||
'Object', | ||
'Enum', | ||
'EnumValue', | ||
'Union', | ||
|
||
'Operation', | ||
'InvalidOperation', | ||
'Schema', | ||
'gql', | ||
'ExecutionResult', | ||
"BaseType", | ||
"Object", | ||
"Enum", | ||
"EnumValue", | ||
"Union", | ||
"Operation", | ||
"InvalidOperation", | ||
"Schema", | ||
"gql", | ||
"ExecutionResult", | ||
) | ||
|
||
try: | ||
from slothql import django | ||
__all__ += ('django',) | ||
|
||
__all__ += ("django",) | ||
except ImportError as e: | ||
if str(e) != "No module named 'django'": | ||
raise |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import os | ||
|
||
BASE_DIR = os.path.dirname(__file__) | ||
TEMPLATE_DIRS = [ | ||
'templates/', | ||
] | ||
TEMPLATE_DIRS = ["templates/"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
from .views import GraphQLView | ||
from .types import Model | ||
from .types import Model, DjangoFilter | ||
|
||
__all__ = ( | ||
'GraphQLView', | ||
'Model', | ||
) | ||
__all__ = ("GraphQLView", "Model", "DjangoFilter") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
from unittest import mock | ||
|
||
from django.db import models | ||
|
||
|
||
@pytest.fixture() | ||
def manager(**kwargs): | ||
return mock.Mock(spec=models.Manager, get_queryset=mock.Mock(side_effect=queryset)) | ||
|
||
|
||
@pytest.fixture() | ||
def model(model_class=None, **kwargs): | ||
default_manager = manager() | ||
return mock.Mock( | ||
spec=model_class or models.Model, | ||
_default_manager=default_manager, | ||
objects=default_manager, | ||
) | ||
|
||
|
||
@pytest.fixture() | ||
def queryset(**kwargs): | ||
model_class = kwargs.pop("model", None) | ||
model_instance = model(model_class=model_class) | ||
queryset_instance = mock.Mock( | ||
spec=models.QuerySet, | ||
side_effect=queryset, | ||
get=mock.Mock(side_effect=lambda: model()), | ||
select_related=mock.Mock(side_effect=lambda *_: queryset_instance), | ||
prefetch_related=mock.Mock(side_effect=lambda *_: queryset_instance), | ||
filter=mock.Mock(side_effect=lambda **_: queryset_instance), | ||
__iter__=lambda self: iter((model_instance, model_instance, model_instance)), | ||
_iterable_class=models.query.ModelIterable, | ||
model=model_class, | ||
**kwargs, | ||
) | ||
return queryset_instance | ||
|
||
|
||
@pytest.fixture() | ||
def queryset_factory(): | ||
return queryset |
Oops, something went wrong.