From f25b4a15a895c490c3bc4f6711288691ba05e47a Mon Sep 17 00:00:00 2001 From: removedporn <86824510+removedporn@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:19:57 +0800 Subject: [PATCH] Delete examples directory --- examples/__init__.py | 0 examples/cookbook-plain/README.md | 64 --------- examples/cookbook-plain/__init__.py | 0 examples/cookbook-plain/cookbook/__init__.py | 0 .../cookbook/ingredients/__init__.py | 0 .../cookbook/ingredients/admin.py | 12 -- .../cookbook/ingredients/apps.py | 7 - .../ingredients/fixtures/ingredients.json | 1 - .../ingredients/migrations/0001_initial.py | 33 ----- .../migrations/0002_auto_20161104_0050.py | 20 --- .../migrations/0003_auto_20181018_1746.py | 17 --- .../ingredients/migrations/__init__.py | 0 .../cookbook/ingredients/models.py | 22 --- .../cookbook/ingredients/schema.py | 51 ------- .../cookbook/ingredients/tests.py | 1 - .../cookbook/ingredients/views.py | 1 - .../cookbook/recipes/__init__.py | 0 .../cookbook-plain/cookbook/recipes/admin.py | 12 -- .../cookbook-plain/cookbook/recipes/apps.py | 7 - .../recipes/migrations/0001_initial.py | 36 ----- .../migrations/0002_auto_20161104_0106.py | 25 ---- .../migrations/0003_auto_20181018_1728.py | 18 --- .../cookbook/recipes/migrations/__init__.py | 0 .../cookbook-plain/cookbook/recipes/models.py | 28 ---- .../cookbook-plain/cookbook/recipes/schema.py | 46 ------- .../cookbook-plain/cookbook/recipes/tests.py | 1 - .../cookbook-plain/cookbook/recipes/views.py | 1 - examples/cookbook-plain/cookbook/schema.py | 16 --- examples/cookbook-plain/cookbook/settings.py | 124 ----------------- examples/cookbook-plain/cookbook/urls.py | 10 -- examples/cookbook-plain/cookbook/wsgi.py | 16 --- examples/cookbook-plain/manage.py | 10 -- examples/cookbook-plain/requirements.txt | 4 - examples/cookbook-plain/setup.cfg | 2 - examples/cookbook/README.md | 64 --------- examples/cookbook/__init__.py | 0 examples/cookbook/cookbook/__init__.py | 0 .../cookbook/cookbook/ingredients/__init__.py | 0 .../cookbook/cookbook/ingredients/admin.py | 12 -- .../cookbook/cookbook/ingredients/apps.py | 7 - .../ingredients/fixtures/ingredients.json | 1 - .../ingredients/migrations/0001_initial.py | 33 ----- .../migrations/0002_auto_20161104_0050.py | 20 --- .../ingredients/migrations/__init__.py | 0 .../cookbook/cookbook/ingredients/models.py | 19 --- .../cookbook/cookbook/ingredients/schema.py | 36 ----- .../cookbook/cookbook/ingredients/tests.py | 1 - .../cookbook/cookbook/ingredients/views.py | 1 - .../cookbook/cookbook/recipes/__init__.py | 0 examples/cookbook/cookbook/recipes/admin.py | 12 -- examples/cookbook/cookbook/recipes/apps.py | 7 - .../recipes/migrations/0001_initial.py | 36 ----- .../migrations/0002_auto_20161104_0106.py | 25 ---- .../cookbook/recipes/migrations/__init__.py | 0 examples/cookbook/cookbook/recipes/models.py | 26 ---- examples/cookbook/cookbook/recipes/schema.py | 33 ----- examples/cookbook/cookbook/recipes/tests.py | 1 - examples/cookbook/cookbook/recipes/views.py | 1 - examples/cookbook/cookbook/schema.py | 16 --- examples/cookbook/cookbook/settings.py | 125 ------------------ examples/cookbook/cookbook/urls.py | 10 -- examples/cookbook/cookbook/wsgi.py | 16 --- examples/cookbook/dummy_data.json | 1 - examples/cookbook/manage.py | 10 -- examples/cookbook/requirements.txt | 5 - examples/cookbook/setup.cfg | 2 - examples/django_test_settings.py | 30 ----- examples/starwars/__init__.py | 0 examples/starwars/data.py | 70 ---------- examples/starwars/models.py | 33 ----- examples/starwars/schema.py | 82 ------------ examples/starwars/tests/__init__.py | 0 examples/starwars/tests/test_connections.py | 57 -------- examples/starwars/tests/test_mutation.py | 53 -------- .../tests/test_objectidentification.py | 96 -------------- 75 files changed, 1526 deletions(-) delete mode 100644 examples/__init__.py delete mode 100644 examples/cookbook-plain/README.md delete mode 100644 examples/cookbook-plain/__init__.py delete mode 100644 examples/cookbook-plain/cookbook/__init__.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/__init__.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/admin.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/apps.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json delete mode 100644 examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/migrations/__init__.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/models.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/schema.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/tests.py delete mode 100644 examples/cookbook-plain/cookbook/ingredients/views.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/__init__.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/admin.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/apps.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/migrations/__init__.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/models.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/schema.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/tests.py delete mode 100644 examples/cookbook-plain/cookbook/recipes/views.py delete mode 100644 examples/cookbook-plain/cookbook/schema.py delete mode 100644 examples/cookbook-plain/cookbook/settings.py delete mode 100644 examples/cookbook-plain/cookbook/urls.py delete mode 100644 examples/cookbook-plain/cookbook/wsgi.py delete mode 100755 examples/cookbook-plain/manage.py delete mode 100644 examples/cookbook-plain/requirements.txt delete mode 100644 examples/cookbook-plain/setup.cfg delete mode 100644 examples/cookbook/README.md delete mode 100644 examples/cookbook/__init__.py delete mode 100644 examples/cookbook/cookbook/__init__.py delete mode 100644 examples/cookbook/cookbook/ingredients/__init__.py delete mode 100644 examples/cookbook/cookbook/ingredients/admin.py delete mode 100644 examples/cookbook/cookbook/ingredients/apps.py delete mode 100644 examples/cookbook/cookbook/ingredients/fixtures/ingredients.json delete mode 100644 examples/cookbook/cookbook/ingredients/migrations/0001_initial.py delete mode 100644 examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py delete mode 100644 examples/cookbook/cookbook/ingredients/migrations/__init__.py delete mode 100644 examples/cookbook/cookbook/ingredients/models.py delete mode 100644 examples/cookbook/cookbook/ingredients/schema.py delete mode 100644 examples/cookbook/cookbook/ingredients/tests.py delete mode 100644 examples/cookbook/cookbook/ingredients/views.py delete mode 100644 examples/cookbook/cookbook/recipes/__init__.py delete mode 100644 examples/cookbook/cookbook/recipes/admin.py delete mode 100644 examples/cookbook/cookbook/recipes/apps.py delete mode 100644 examples/cookbook/cookbook/recipes/migrations/0001_initial.py delete mode 100644 examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py delete mode 100644 examples/cookbook/cookbook/recipes/migrations/__init__.py delete mode 100644 examples/cookbook/cookbook/recipes/models.py delete mode 100644 examples/cookbook/cookbook/recipes/schema.py delete mode 100644 examples/cookbook/cookbook/recipes/tests.py delete mode 100644 examples/cookbook/cookbook/recipes/views.py delete mode 100644 examples/cookbook/cookbook/schema.py delete mode 100644 examples/cookbook/cookbook/settings.py delete mode 100644 examples/cookbook/cookbook/urls.py delete mode 100644 examples/cookbook/cookbook/wsgi.py delete mode 100644 examples/cookbook/dummy_data.json delete mode 100755 examples/cookbook/manage.py delete mode 100644 examples/cookbook/requirements.txt delete mode 100644 examples/cookbook/setup.cfg delete mode 100644 examples/django_test_settings.py delete mode 100644 examples/starwars/__init__.py delete mode 100644 examples/starwars/data.py delete mode 100644 examples/starwars/models.py delete mode 100644 examples/starwars/schema.py delete mode 100644 examples/starwars/tests/__init__.py delete mode 100644 examples/starwars/tests/test_connections.py delete mode 100644 examples/starwars/tests/test_mutation.py delete mode 100644 examples/starwars/tests/test_objectidentification.py diff --git a/examples/__init__.py b/examples/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook-plain/README.md b/examples/cookbook-plain/README.md deleted file mode 100644 index 0ec906b..0000000 --- a/examples/cookbook-plain/README.md +++ /dev/null @@ -1,64 +0,0 @@ -Cookbook Example Django Project -=============================== - -This example project demos integration between Graphene and Django. -The project contains two apps, one named `ingredients` and another -named `recipes`. - -Getting started ---------------- - -First you'll need to get the source of the project. Do this by cloning the -whole Graphene repository: - -```bash -# Get the example project code -git clone https://github.com/graphql-python/graphene-django.git -cd graphene-django/examples/cookbook -``` - -It is good idea (but not required) to create a virtual environment -for this project. We'll do this using -[virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) -to keep things simple, -but you may also find something like -[virtualenvwrapper](https://virtualenvwrapper.readthedocs.org/en/latest/) -to be useful: - -```bash -# Create a virtualenv in which we can install the dependencies -virtualenv env -source env/bin/activate -``` - -Now we can install our dependencies: - -```bash -pip install -r requirements.txt -``` - -Now setup our database: - -```bash -# Setup the database -./manage.py migrate - -# Load some example data -./manage.py loaddata ingredients - -# Create an admin user (useful for logging into the admin UI -# at http://127.0.0.1:8000/admin) -./manage.py createsuperuser -``` - -Now you should be ready to start the server: - -```bash -./manage.py runserver -``` - -Now head on over to -[http://127.0.0.1:8000/graphql](http://127.0.0.1:8000/graphql) -and run some queries! -(See the [Graphene-Django Tutorial](http://docs.graphene-python.org/projects/django/en/latest/tutorial-plain/#testing-our-graphql-schema) -for some example queries) diff --git a/examples/cookbook-plain/__init__.py b/examples/cookbook-plain/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook-plain/cookbook/__init__.py b/examples/cookbook-plain/cookbook/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook-plain/cookbook/ingredients/__init__.py b/examples/cookbook-plain/cookbook/ingredients/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook-plain/cookbook/ingredients/admin.py b/examples/cookbook-plain/cookbook/ingredients/admin.py deleted file mode 100644 index 042682f..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/admin.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.contrib import admin - -from cookbook.ingredients.models import Category, Ingredient - - -@admin.register(Ingredient) -class IngredientAdmin(admin.ModelAdmin): - list_display = ("id", "name", "category") - list_editable = ("name", "category") - - -admin.site.register(Category) diff --git a/examples/cookbook-plain/cookbook/ingredients/apps.py b/examples/cookbook-plain/cookbook/ingredients/apps.py deleted file mode 100644 index 3ad0143..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/apps.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.apps import AppConfig - - -class IngredientsConfig(AppConfig): - name = "cookbook.ingredients" - label = "ingredients" - verbose_name = "Ingredients" diff --git a/examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json b/examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json deleted file mode 100644 index 8625d3c..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json +++ /dev/null @@ -1 +0,0 @@ -[{"model": "ingredients.category", "pk": 1, "fields": {"name": "Dairy"}}, {"model": "ingredients.category", "pk": 2, "fields": {"name": "Meat"}}, {"model": "ingredients.ingredient", "pk": 1, "fields": {"name": "Eggs", "notes": "Good old eggs", "category": 1}}, {"model": "ingredients.ingredient", "pk": 2, "fields": {"name": "Milk", "notes": "Comes from a cow", "category": 1}}, {"model": "ingredients.ingredient", "pk": 3, "fields": {"name": "Beef", "notes": "Much like milk, this comes from a cow", "category": 2}}, {"model": "ingredients.ingredient", "pk": 4, "fields": {"name": "Chicken", "notes": "Definitely doesn't come from a cow", "category": 2}}] \ No newline at end of file diff --git a/examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py b/examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py deleted file mode 100644 index 0494923..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2015-12-04 18:15 -from __future__ import unicode_literals - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Category', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ], - ), - migrations.CreateModel( - name='Ingredient', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('notes', models.TextField()), - ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ingredients', to='ingredients.Category')), - ], - ), - ] diff --git a/examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py b/examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py deleted file mode 100644 index 359d4fc..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-11-04 00:50 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('ingredients', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='ingredient', - name='notes', - field=models.TextField(blank=True, null=True), - ), - ] diff --git a/examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py b/examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py deleted file mode 100644 index 184e79e..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.0 on 2018-10-18 17:46 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('ingredients', '0002_auto_20161104_0050'), - ] - - operations = [ - migrations.AlterModelOptions( - name='category', - options={'verbose_name_plural': 'Categories'}, - ), - ] diff --git a/examples/cookbook-plain/cookbook/ingredients/migrations/__init__.py b/examples/cookbook-plain/cookbook/ingredients/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook-plain/cookbook/ingredients/models.py b/examples/cookbook-plain/cookbook/ingredients/models.py deleted file mode 100644 index 5d88785..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/models.py +++ /dev/null @@ -1,22 +0,0 @@ -from django.db import models - - -class Category(models.Model): - class Meta: - verbose_name_plural = "Categories" - - name = models.CharField(max_length=100) - - def __str__(self): - return self.name - - -class Ingredient(models.Model): - name = models.CharField(max_length=100) - notes = models.TextField(null=True, blank=True) - category = models.ForeignKey( - Category, related_name="ingredients", on_delete=models.CASCADE - ) - - def __str__(self): - return self.name diff --git a/examples/cookbook-plain/cookbook/ingredients/schema.py b/examples/cookbook-plain/cookbook/ingredients/schema.py deleted file mode 100644 index 24a5e95..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/schema.py +++ /dev/null @@ -1,51 +0,0 @@ -import graphene -from graphene_django.types import DjangoObjectType - -from .models import Category, Ingredient - - -class CategoryType(DjangoObjectType): - class Meta: - model = Category - fields = "__all__" - - -class IngredientType(DjangoObjectType): - class Meta: - model = Ingredient - fields = "__all__" - - -class Query(object): - category = graphene.Field(CategoryType, id=graphene.Int(), name=graphene.String()) - all_categories = graphene.List(CategoryType) - - ingredient = graphene.Field( - IngredientType, id=graphene.Int(), name=graphene.String() - ) - all_ingredients = graphene.List(IngredientType) - - def resolve_all_categories(self, context): - return Category.objects.all() - - def resolve_all_ingredients(self, context): - # We can easily optimize query count in the resolve method - return Ingredient.objects.select_related("category").all() - - def resolve_category(self, context, id=None, name=None): - if id is not None: - return Category.objects.get(pk=id) - - if name is not None: - return Category.objects.get(name=name) - - return None - - def resolve_ingredient(self, context, id=None, name=None): - if id is not None: - return Ingredient.objects.get(pk=id) - - if name is not None: - return Ingredient.objects.get(name=name) - - return None diff --git a/examples/cookbook-plain/cookbook/ingredients/tests.py b/examples/cookbook-plain/cookbook/ingredients/tests.py deleted file mode 100644 index a39b155..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/tests.py +++ /dev/null @@ -1 +0,0 @@ -# Create your tests here. diff --git a/examples/cookbook-plain/cookbook/ingredients/views.py b/examples/cookbook-plain/cookbook/ingredients/views.py deleted file mode 100644 index 60f00ef..0000000 --- a/examples/cookbook-plain/cookbook/ingredients/views.py +++ /dev/null @@ -1 +0,0 @@ -# Create your views here. diff --git a/examples/cookbook-plain/cookbook/recipes/__init__.py b/examples/cookbook-plain/cookbook/recipes/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook-plain/cookbook/recipes/admin.py b/examples/cookbook-plain/cookbook/recipes/admin.py deleted file mode 100644 index 10d568f..0000000 --- a/examples/cookbook-plain/cookbook/recipes/admin.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.contrib import admin - -from cookbook.recipes.models import Recipe, RecipeIngredient - - -class RecipeIngredientInline(admin.TabularInline): - model = RecipeIngredient - - -@admin.register(Recipe) -class RecipeAdmin(admin.ModelAdmin): - inlines = [RecipeIngredientInline] diff --git a/examples/cookbook-plain/cookbook/recipes/apps.py b/examples/cookbook-plain/cookbook/recipes/apps.py deleted file mode 100644 index f1e4dde..0000000 --- a/examples/cookbook-plain/cookbook/recipes/apps.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.apps import AppConfig - - -class RecipesConfig(AppConfig): - name = "cookbook.recipes" - label = "recipes" - verbose_name = "Recipes" diff --git a/examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py b/examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py deleted file mode 100644 index 338c71a..0000000 --- a/examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2015-12-04 18:20 -from __future__ import unicode_literals - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('ingredients', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='Recipe', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=100)), - ('instructions', models.TextField()), - ], - ), - migrations.CreateModel( - name='RecipeIngredient', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('amount', models.FloatField()), - ('unit', models.CharField(choices=[('kg', 'Kilograms'), ('l', 'Litres'), ('', 'Units')], max_length=20)), - ('ingredient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='used_by', to='ingredients.Ingredient')), - ('recipes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amounts', to='recipes.Recipe')), - ], - ), - ] diff --git a/examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py b/examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py deleted file mode 100644 index f135392..0000000 --- a/examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-11-04 01:06 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('recipes', '0001_initial'), - ] - - operations = [ - migrations.RenameField( - model_name='recipeingredient', - old_name='recipes', - new_name='recipe', - ), - migrations.AlterField( - model_name='recipeingredient', - name='unit', - field=models.CharField(choices=[(b'unit', b'Units'), (b'kg', b'Kilograms'), (b'l', b'Litres'), (b'st', b'Shots')], max_length=20), - ), - ] diff --git a/examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py b/examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py deleted file mode 100644 index 7a8df49..0000000 --- a/examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.0 on 2018-10-18 17:28 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('recipes', '0002_auto_20161104_0106'), - ] - - operations = [ - migrations.AlterField( - model_name='recipeingredient', - name='unit', - field=models.CharField(choices=[('unit', 'Units'), ('kg', 'Kilograms'), ('l', 'Litres'), ('st', 'Shots')], max_length=20), - ), - ] diff --git a/examples/cookbook-plain/cookbook/recipes/migrations/__init__.py b/examples/cookbook-plain/cookbook/recipes/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook-plain/cookbook/recipes/models.py b/examples/cookbook-plain/cookbook/recipes/models.py deleted file mode 100644 index f6e955e..0000000 --- a/examples/cookbook-plain/cookbook/recipes/models.py +++ /dev/null @@ -1,28 +0,0 @@ -from django.db import models - -from ..ingredients.models import Ingredient - - -class Recipe(models.Model): - title = models.CharField(max_length=100) - instructions = models.TextField() - - def __str__(self): - return self.title - - -class RecipeIngredient(models.Model): - recipe = models.ForeignKey(Recipe, related_name="amounts", on_delete=models.CASCADE) - ingredient = models.ForeignKey( - Ingredient, related_name="used_by", on_delete=models.CASCADE - ) - amount = models.FloatField() - unit = models.CharField( - max_length=20, - choices=( - ("unit", "Units"), - ("kg", "Kilograms"), - ("l", "Litres"), - ("st", "Shots"), - ), - ) diff --git a/examples/cookbook-plain/cookbook/recipes/schema.py b/examples/cookbook-plain/cookbook/recipes/schema.py deleted file mode 100644 index aa7fd2d..0000000 --- a/examples/cookbook-plain/cookbook/recipes/schema.py +++ /dev/null @@ -1,46 +0,0 @@ -import graphene -from graphene_django.types import DjangoObjectType - -from .models import Recipe, RecipeIngredient - - -class RecipeType(DjangoObjectType): - class Meta: - model = Recipe - fields = "__all__" - - -class RecipeIngredientType(DjangoObjectType): - class Meta: - model = RecipeIngredient - fields = "__all__" - - -class Query(object): - recipe = graphene.Field(RecipeType, id=graphene.Int(), title=graphene.String()) - all_recipes = graphene.List(RecipeType) - - recipeingredient = graphene.Field(RecipeIngredientType, id=graphene.Int()) - all_recipeingredients = graphene.List(RecipeIngredientType) - - def resolve_recipe(self, context, id=None, title=None): - if id is not None: - return Recipe.objects.get(pk=id) - - if title is not None: - return Recipe.objects.get(title=title) - - return None - - def resolve_recipeingredient(self, context, id=None): - if id is not None: - return RecipeIngredient.objects.get(pk=id) - - return None - - def resolve_all_recipes(self, context): - return Recipe.objects.all() - - def resolve_all_recipeingredients(self, context): - related = ["recipe", "ingredient"] - return RecipeIngredient.objects.select_related(*related).all() diff --git a/examples/cookbook-plain/cookbook/recipes/tests.py b/examples/cookbook-plain/cookbook/recipes/tests.py deleted file mode 100644 index a39b155..0000000 --- a/examples/cookbook-plain/cookbook/recipes/tests.py +++ /dev/null @@ -1 +0,0 @@ -# Create your tests here. diff --git a/examples/cookbook-plain/cookbook/recipes/views.py b/examples/cookbook-plain/cookbook/recipes/views.py deleted file mode 100644 index 60f00ef..0000000 --- a/examples/cookbook-plain/cookbook/recipes/views.py +++ /dev/null @@ -1 +0,0 @@ -# Create your views here. diff --git a/examples/cookbook-plain/cookbook/schema.py b/examples/cookbook-plain/cookbook/schema.py deleted file mode 100644 index bde9372..0000000 --- a/examples/cookbook-plain/cookbook/schema.py +++ /dev/null @@ -1,16 +0,0 @@ -import cookbook.ingredients.schema -import cookbook.recipes.schema -import graphene - -from graphene_django.debug import DjangoDebug - - -class Query( - cookbook.ingredients.schema.Query, - cookbook.recipes.schema.Query, - graphene.ObjectType, -): - debug = graphene.Field(DjangoDebug, name="_debug") - - -schema = graphene.Schema(query=Query) diff --git a/examples/cookbook-plain/cookbook/settings.py b/examples/cookbook-plain/cookbook/settings.py deleted file mode 100644 index 7eb9d56..0000000 --- a/examples/cookbook-plain/cookbook/settings.py +++ /dev/null @@ -1,124 +0,0 @@ -# flake8: noqa -""" -Django settings for cookbook project. - -Generated by 'django-admin startproject' using Django 1.9. - -For more information on this file, see -https://docs.djangoproject.com/en/1.9/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.9/ref/settings/ -""" - -import os - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "_$=$%eqxk$8ss4n7mtgarw^5$8^d5+c83!vwatr@i_81myb=e4" - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - - -# Application definition - -INSTALLED_APPS = [ - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - "graphene_django", - "cookbook.ingredients.apps.IngredientsConfig", - "cookbook.recipes.apps.RecipesConfig", -] - -MIDDLEWARE = [ - "django.middleware.security.SecurityMiddleware", - "django.contrib.sessions.middleware.SessionMiddleware", - "django.middleware.common.CommonMiddleware", - "django.middleware.csrf.CsrfViewMiddleware", - "django.contrib.auth.middleware.AuthenticationMiddleware", - "django.contrib.messages.middleware.MessageMiddleware", - "django.middleware.clickjacking.XFrameOptionsMiddleware", -] - -GRAPHENE = { - "SCHEMA": "cookbook.schema.schema", - "SCHEMA_INDENT": 2, - "MIDDLEWARE": ("graphene_django.debug.DjangoDebugMiddleware",), -} - -ROOT_URLCONF = "cookbook.urls" - -TEMPLATES = [ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], - "APP_DIRS": True, - "OPTIONS": { - "context_processors": [ - "django.template.context_processors.debug", - "django.template.context_processors.request", - "django.contrib.auth.context_processors.auth", - "django.contrib.messages.context_processors.messages", - ] - }, - } -] - -WSGI_APPLICATION = "cookbook.wsgi.application" - - -# Database -# https://docs.djangoproject.com/en/1.9/ref/settings/#databases - -DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": os.path.join(BASE_DIR, "db.sqlite3"), - } -} - - -# Password validation -# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator" - }, - {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"}, - {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"}, - {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"}, -] - - -# Internationalization -# https://docs.djangoproject.com/en/1.9/topics/i18n/ - -LANGUAGE_CODE = "en-us" - -TIME_ZONE = "UTC" - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.9/howto/static-files/ - -STATIC_URL = "/static/" diff --git a/examples/cookbook-plain/cookbook/urls.py b/examples/cookbook-plain/cookbook/urls.py deleted file mode 100644 index a64a875..0000000 --- a/examples/cookbook-plain/cookbook/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.urls import path -from django.contrib import admin - -from graphene_django.views import GraphQLView - - -urlpatterns = [ - path("admin/", admin.site.urls), - path("graphql/", GraphQLView.as_view(graphiql=True)), -] diff --git a/examples/cookbook-plain/cookbook/wsgi.py b/examples/cookbook-plain/cookbook/wsgi.py deleted file mode 100644 index 954b0a8..0000000 --- a/examples/cookbook-plain/cookbook/wsgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -WSGI config for cookbook project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ -""" - -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cookbook.settings") - -application = get_wsgi_application() diff --git a/examples/cookbook-plain/manage.py b/examples/cookbook-plain/manage.py deleted file mode 100755 index 8d8a34d..0000000 --- a/examples/cookbook-plain/manage.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cookbook.settings") - - from django.core.management import execute_from_command_line - - execute_from_command_line(sys.argv) diff --git a/examples/cookbook-plain/requirements.txt b/examples/cookbook-plain/requirements.txt deleted file mode 100644 index 9fc1a3a..0000000 --- a/examples/cookbook-plain/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -graphene>=2.1,<3 -graphene-django>=2.1,<3 -graphql-core>=2.1,<3 -django==3.1.8 diff --git a/examples/cookbook-plain/setup.cfg b/examples/cookbook-plain/setup.cfg deleted file mode 100644 index 8c6a6e8..0000000 --- a/examples/cookbook-plain/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[flake8] -exclude=migrations,.git,__pycache__ diff --git a/examples/cookbook/README.md b/examples/cookbook/README.md deleted file mode 100644 index 0ec906b..0000000 --- a/examples/cookbook/README.md +++ /dev/null @@ -1,64 +0,0 @@ -Cookbook Example Django Project -=============================== - -This example project demos integration between Graphene and Django. -The project contains two apps, one named `ingredients` and another -named `recipes`. - -Getting started ---------------- - -First you'll need to get the source of the project. Do this by cloning the -whole Graphene repository: - -```bash -# Get the example project code -git clone https://github.com/graphql-python/graphene-django.git -cd graphene-django/examples/cookbook -``` - -It is good idea (but not required) to create a virtual environment -for this project. We'll do this using -[virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) -to keep things simple, -but you may also find something like -[virtualenvwrapper](https://virtualenvwrapper.readthedocs.org/en/latest/) -to be useful: - -```bash -# Create a virtualenv in which we can install the dependencies -virtualenv env -source env/bin/activate -``` - -Now we can install our dependencies: - -```bash -pip install -r requirements.txt -``` - -Now setup our database: - -```bash -# Setup the database -./manage.py migrate - -# Load some example data -./manage.py loaddata ingredients - -# Create an admin user (useful for logging into the admin UI -# at http://127.0.0.1:8000/admin) -./manage.py createsuperuser -``` - -Now you should be ready to start the server: - -```bash -./manage.py runserver -``` - -Now head on over to -[http://127.0.0.1:8000/graphql](http://127.0.0.1:8000/graphql) -and run some queries! -(See the [Graphene-Django Tutorial](http://docs.graphene-python.org/projects/django/en/latest/tutorial-plain/#testing-our-graphql-schema) -for some example queries) diff --git a/examples/cookbook/__init__.py b/examples/cookbook/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook/cookbook/__init__.py b/examples/cookbook/cookbook/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook/cookbook/ingredients/__init__.py b/examples/cookbook/cookbook/ingredients/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook/cookbook/ingredients/admin.py b/examples/cookbook/cookbook/ingredients/admin.py deleted file mode 100644 index 042682f..0000000 --- a/examples/cookbook/cookbook/ingredients/admin.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.contrib import admin - -from cookbook.ingredients.models import Category, Ingredient - - -@admin.register(Ingredient) -class IngredientAdmin(admin.ModelAdmin): - list_display = ("id", "name", "category") - list_editable = ("name", "category") - - -admin.site.register(Category) diff --git a/examples/cookbook/cookbook/ingredients/apps.py b/examples/cookbook/cookbook/ingredients/apps.py deleted file mode 100644 index 3ad0143..0000000 --- a/examples/cookbook/cookbook/ingredients/apps.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.apps import AppConfig - - -class IngredientsConfig(AppConfig): - name = "cookbook.ingredients" - label = "ingredients" - verbose_name = "Ingredients" diff --git a/examples/cookbook/cookbook/ingredients/fixtures/ingredients.json b/examples/cookbook/cookbook/ingredients/fixtures/ingredients.json deleted file mode 100644 index 8625d3c..0000000 --- a/examples/cookbook/cookbook/ingredients/fixtures/ingredients.json +++ /dev/null @@ -1 +0,0 @@ -[{"model": "ingredients.category", "pk": 1, "fields": {"name": "Dairy"}}, {"model": "ingredients.category", "pk": 2, "fields": {"name": "Meat"}}, {"model": "ingredients.ingredient", "pk": 1, "fields": {"name": "Eggs", "notes": "Good old eggs", "category": 1}}, {"model": "ingredients.ingredient", "pk": 2, "fields": {"name": "Milk", "notes": "Comes from a cow", "category": 1}}, {"model": "ingredients.ingredient", "pk": 3, "fields": {"name": "Beef", "notes": "Much like milk, this comes from a cow", "category": 2}}, {"model": "ingredients.ingredient", "pk": 4, "fields": {"name": "Chicken", "notes": "Definitely doesn't come from a cow", "category": 2}}] \ No newline at end of file diff --git a/examples/cookbook/cookbook/ingredients/migrations/0001_initial.py b/examples/cookbook/cookbook/ingredients/migrations/0001_initial.py deleted file mode 100644 index 0494923..0000000 --- a/examples/cookbook/cookbook/ingredients/migrations/0001_initial.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2015-12-04 18:15 -from __future__ import unicode_literals - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Category', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ], - ), - migrations.CreateModel( - name='Ingredient', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('notes', models.TextField()), - ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ingredients', to='ingredients.Category')), - ], - ), - ] diff --git a/examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py b/examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py deleted file mode 100644 index 359d4fc..0000000 --- a/examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-11-04 00:50 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('ingredients', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='ingredient', - name='notes', - field=models.TextField(blank=True, null=True), - ), - ] diff --git a/examples/cookbook/cookbook/ingredients/migrations/__init__.py b/examples/cookbook/cookbook/ingredients/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook/cookbook/ingredients/models.py b/examples/cookbook/cookbook/ingredients/models.py deleted file mode 100644 index 1e97226..0000000 --- a/examples/cookbook/cookbook/ingredients/models.py +++ /dev/null @@ -1,19 +0,0 @@ -from django.db import models - - -class Category(models.Model): - name = models.CharField(max_length=100) - - def __str__(self): - return self.name - - -class Ingredient(models.Model): - name = models.CharField(max_length=100) - notes = models.TextField(null=True, blank=True) - category = models.ForeignKey( - Category, related_name="ingredients", on_delete=models.CASCADE - ) - - def __str__(self): - return self.name diff --git a/examples/cookbook/cookbook/ingredients/schema.py b/examples/cookbook/cookbook/ingredients/schema.py deleted file mode 100644 index 43b6118..0000000 --- a/examples/cookbook/cookbook/ingredients/schema.py +++ /dev/null @@ -1,36 +0,0 @@ -from cookbook.ingredients.models import Category, Ingredient -from graphene import Node -from graphene_django.filter import DjangoFilterConnectionField -from graphene_django.types import DjangoObjectType - - -# Graphene will automatically map the Category model's fields onto the CategoryNode. -# This is configured in the CategoryNode's Meta class (as you can see below) -class CategoryNode(DjangoObjectType): - class Meta: - model = Category - interfaces = (Node,) - fields = "__all__" - filter_fields = ["name", "ingredients"] - - -class IngredientNode(DjangoObjectType): - class Meta: - model = Ingredient - # Allow for some more advanced filtering here - interfaces = (Node,) - fields = "__all__" - filter_fields = { - "name": ["exact", "icontains", "istartswith"], - "notes": ["exact", "icontains"], - "category": ["exact"], - "category__name": ["exact"], - } - - -class Query(object): - category = Node.Field(CategoryNode) - all_categories = DjangoFilterConnectionField(CategoryNode) - - ingredient = Node.Field(IngredientNode) - all_ingredients = DjangoFilterConnectionField(IngredientNode) diff --git a/examples/cookbook/cookbook/ingredients/tests.py b/examples/cookbook/cookbook/ingredients/tests.py deleted file mode 100644 index a39b155..0000000 --- a/examples/cookbook/cookbook/ingredients/tests.py +++ /dev/null @@ -1 +0,0 @@ -# Create your tests here. diff --git a/examples/cookbook/cookbook/ingredients/views.py b/examples/cookbook/cookbook/ingredients/views.py deleted file mode 100644 index 60f00ef..0000000 --- a/examples/cookbook/cookbook/ingredients/views.py +++ /dev/null @@ -1 +0,0 @@ -# Create your views here. diff --git a/examples/cookbook/cookbook/recipes/__init__.py b/examples/cookbook/cookbook/recipes/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook/cookbook/recipes/admin.py b/examples/cookbook/cookbook/recipes/admin.py deleted file mode 100644 index 10d568f..0000000 --- a/examples/cookbook/cookbook/recipes/admin.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.contrib import admin - -from cookbook.recipes.models import Recipe, RecipeIngredient - - -class RecipeIngredientInline(admin.TabularInline): - model = RecipeIngredient - - -@admin.register(Recipe) -class RecipeAdmin(admin.ModelAdmin): - inlines = [RecipeIngredientInline] diff --git a/examples/cookbook/cookbook/recipes/apps.py b/examples/cookbook/cookbook/recipes/apps.py deleted file mode 100644 index f1e4dde..0000000 --- a/examples/cookbook/cookbook/recipes/apps.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.apps import AppConfig - - -class RecipesConfig(AppConfig): - name = "cookbook.recipes" - label = "recipes" - verbose_name = "Recipes" diff --git a/examples/cookbook/cookbook/recipes/migrations/0001_initial.py b/examples/cookbook/cookbook/recipes/migrations/0001_initial.py deleted file mode 100644 index 338c71a..0000000 --- a/examples/cookbook/cookbook/recipes/migrations/0001_initial.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2015-12-04 18:20 -from __future__ import unicode_literals - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('ingredients', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='Recipe', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=100)), - ('instructions', models.TextField()), - ], - ), - migrations.CreateModel( - name='RecipeIngredient', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('amount', models.FloatField()), - ('unit', models.CharField(choices=[('kg', 'Kilograms'), ('l', 'Litres'), ('', 'Units')], max_length=20)), - ('ingredient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='used_by', to='ingredients.Ingredient')), - ('recipes', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='amounts', to='recipes.Recipe')), - ], - ), - ] diff --git a/examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py b/examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py deleted file mode 100644 index f135392..0000000 --- a/examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9 on 2016-11-04 01:06 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('recipes', '0001_initial'), - ] - - operations = [ - migrations.RenameField( - model_name='recipeingredient', - old_name='recipes', - new_name='recipe', - ), - migrations.AlterField( - model_name='recipeingredient', - name='unit', - field=models.CharField(choices=[(b'unit', b'Units'), (b'kg', b'Kilograms'), (b'l', b'Litres'), (b'st', b'Shots')], max_length=20), - ), - ] diff --git a/examples/cookbook/cookbook/recipes/migrations/__init__.py b/examples/cookbook/cookbook/recipes/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/cookbook/cookbook/recipes/models.py b/examples/cookbook/cookbook/recipes/models.py deleted file mode 100644 index 0bfb434..0000000 --- a/examples/cookbook/cookbook/recipes/models.py +++ /dev/null @@ -1,26 +0,0 @@ -from django.db import models - -from cookbook.ingredients.models import Ingredient - - -class Recipe(models.Model): - title = models.CharField(max_length=100) - instructions = models.TextField() - __unicode__ = lambda self: self.title - - -class RecipeIngredient(models.Model): - recipe = models.ForeignKey(Recipe, related_name="amounts", on_delete=models.CASCADE) - ingredient = models.ForeignKey( - Ingredient, related_name="used_by", on_delete=models.CASCADE - ) - amount = models.FloatField() - unit = models.CharField( - max_length=20, - choices=( - ("unit", "Units"), - ("kg", "Kilograms"), - ("l", "Litres"), - ("st", "Shots"), - ), - ) diff --git a/examples/cookbook/cookbook/recipes/schema.py b/examples/cookbook/cookbook/recipes/schema.py deleted file mode 100644 index c7298aa..0000000 --- a/examples/cookbook/cookbook/recipes/schema.py +++ /dev/null @@ -1,33 +0,0 @@ -from cookbook.recipes.models import Recipe, RecipeIngredient -from graphene import Node -from graphene_django.filter import DjangoFilterConnectionField -from graphene_django.types import DjangoObjectType - - -class RecipeNode(DjangoObjectType): - class Meta: - model = Recipe - interfaces = (Node,) - fields = "__all__" - filter_fields = ["title", "amounts"] - - -class RecipeIngredientNode(DjangoObjectType): - class Meta: - model = RecipeIngredient - # Allow for some more advanced filtering here - interfaces = (Node,) - fields = "__all__" - filter_fields = { - "ingredient__name": ["exact", "icontains", "istartswith"], - "recipe": ["exact"], - "recipe__title": ["icontains"], - } - - -class Query(object): - recipe = Node.Field(RecipeNode) - all_recipes = DjangoFilterConnectionField(RecipeNode) - - recipeingredient = Node.Field(RecipeIngredientNode) - all_recipeingredients = DjangoFilterConnectionField(RecipeIngredientNode) diff --git a/examples/cookbook/cookbook/recipes/tests.py b/examples/cookbook/cookbook/recipes/tests.py deleted file mode 100644 index a39b155..0000000 --- a/examples/cookbook/cookbook/recipes/tests.py +++ /dev/null @@ -1 +0,0 @@ -# Create your tests here. diff --git a/examples/cookbook/cookbook/recipes/views.py b/examples/cookbook/cookbook/recipes/views.py deleted file mode 100644 index 60f00ef..0000000 --- a/examples/cookbook/cookbook/recipes/views.py +++ /dev/null @@ -1 +0,0 @@ -# Create your views here. diff --git a/examples/cookbook/cookbook/schema.py b/examples/cookbook/cookbook/schema.py deleted file mode 100644 index bde9372..0000000 --- a/examples/cookbook/cookbook/schema.py +++ /dev/null @@ -1,16 +0,0 @@ -import cookbook.ingredients.schema -import cookbook.recipes.schema -import graphene - -from graphene_django.debug import DjangoDebug - - -class Query( - cookbook.ingredients.schema.Query, - cookbook.recipes.schema.Query, - graphene.ObjectType, -): - debug = graphene.Field(DjangoDebug, name="_debug") - - -schema = graphene.Schema(query=Query) diff --git a/examples/cookbook/cookbook/settings.py b/examples/cookbook/cookbook/settings.py deleted file mode 100644 index 3e941b8..0000000 --- a/examples/cookbook/cookbook/settings.py +++ /dev/null @@ -1,125 +0,0 @@ -# flake8: noqa -""" -Django settings for cookbook project. - -Generated by 'django-admin startproject' using Django 1.9. - -For more information on this file, see -https://docs.djangoproject.com/en/1.9/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.9/ref/settings/ -""" - -import os - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "_$=$%eqxk$8ss4n7mtgarw^5$8^d5+c83!vwatr@i_81myb=e4" - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - - -# Application definition - -INSTALLED_APPS = [ - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - "graphene_django", - "cookbook.ingredients.apps.IngredientsConfig", - "cookbook.recipes.apps.RecipesConfig", - "django_filters", -] - -MIDDLEWARE = [ - "django.middleware.security.SecurityMiddleware", - "django.contrib.sessions.middleware.SessionMiddleware", - "django.middleware.common.CommonMiddleware", - "django.middleware.csrf.CsrfViewMiddleware", - "django.contrib.auth.middleware.AuthenticationMiddleware", - "django.contrib.messages.middleware.MessageMiddleware", - "django.middleware.clickjacking.XFrameOptionsMiddleware", -] - -GRAPHENE = { - "SCHEMA": "cookbook.schema.schema", - "SCHEMA_INDENT": 2, - "MIDDLEWARE": ("graphene_django.debug.DjangoDebugMiddleware",), -} - -ROOT_URLCONF = "cookbook.urls" - -TEMPLATES = [ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], - "APP_DIRS": True, - "OPTIONS": { - "context_processors": [ - "django.template.context_processors.debug", - "django.template.context_processors.request", - "django.contrib.auth.context_processors.auth", - "django.contrib.messages.context_processors.messages", - ] - }, - } -] - -WSGI_APPLICATION = "cookbook.wsgi.application" - - -# Database -# https://docs.djangoproject.com/en/1.9/ref/settings/#databases - -DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": os.path.join(BASE_DIR, "db.sqlite3"), - } -} - - -# Password validation -# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator" - }, - {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"}, - {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"}, - {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"}, -] - - -# Internationalization -# https://docs.djangoproject.com/en/1.9/topics/i18n/ - -LANGUAGE_CODE = "en-us" - -TIME_ZONE = "UTC" - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.9/howto/static-files/ - -STATIC_URL = "/static/" diff --git a/examples/cookbook/cookbook/urls.py b/examples/cookbook/cookbook/urls.py deleted file mode 100644 index 6f8a302..0000000 --- a/examples/cookbook/cookbook/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.conf.urls import url -from django.contrib import admin - -from graphene_django.views import GraphQLView - - -urlpatterns = [ - url(r"^admin/", admin.site.urls), - url(r"^graphql$", GraphQLView.as_view(graphiql=True)), -] diff --git a/examples/cookbook/cookbook/wsgi.py b/examples/cookbook/cookbook/wsgi.py deleted file mode 100644 index 954b0a8..0000000 --- a/examples/cookbook/cookbook/wsgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -WSGI config for cookbook project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ -""" - -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cookbook.settings") - -application = get_wsgi_application() diff --git a/examples/cookbook/dummy_data.json b/examples/cookbook/dummy_data.json deleted file mode 100644 index f541da5..0000000 --- a/examples/cookbook/dummy_data.json +++ /dev/null @@ -1 +0,0 @@ -[{"model": "auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$24000$0SgBlSlnbv5c$ijVQipm2aNDlcrTL8Qi3SVNHphTm4HIsDfUi4kn9tog=", "last_login": "2016-11-04T00:46:58Z", "is_superuser": true, "username": "admin", "first_name": "", "last_name": "", "email": "asdf@example.com", "is_staff": true, "is_active": true, "date_joined": "2016-11-03T18:24:40Z", "groups": [], "user_permissions": []}}, {"model": "recipes.recipe", "pk": 1, "fields": {"title": "Cheerios With a Shot of Vermouth", "instructions": "https://xkcd.com/720/"}}, {"model": "recipes.recipe", "pk": 2, "fields": {"title": "Quail Eggs in Whipped Cream and MSG", "instructions": "https://xkcd.com/720/"}}, {"model": "recipes.recipe", "pk": 3, "fields": {"title": "Deep Fried Skittles", "instructions": "https://xkcd.com/720/"}}, {"model": "recipes.recipe", "pk": 4, "fields": {"title": "Newt ala Doritos", "instructions": "https://xkcd.com/720/"}}, {"model": "recipes.recipe", "pk": 5, "fields": {"title": "Fruit Salad", "instructions": "Chop up and add together"}}, {"model": "recipes.recipeingredient", "pk": 1, "fields": {"recipes": 5, "ingredient": 9, "amount": 1.0, "unit": "unit"}}, {"model": "recipes.recipeingredient", "pk": 2, "fields": {"recipes": 5, "ingredient": 10, "amount": 2.0, "unit": "unit"}}, {"model": "recipes.recipeingredient", "pk": 3, "fields": {"recipes": 5, "ingredient": 7, "amount": 3.0, "unit": "unit"}}, {"model": "recipes.recipeingredient", "pk": 4, "fields": {"recipes": 5, "ingredient": 8, "amount": 4.0, "unit": "unit"}}, {"model": "recipes.recipeingredient", "pk": 5, "fields": {"recipes": 4, "ingredient": 5, "amount": 1.0, "unit": "kg"}}, {"model": "recipes.recipeingredient", "pk": 6, "fields": {"recipes": 4, "ingredient": 6, "amount": 2.0, "unit": "l"}}, {"model": "recipes.recipeingredient", "pk": 7, "fields": {"recipes": 3, "ingredient": 4, "amount": 1.0, "unit": "unit"}}, {"model": "recipes.recipeingredient", "pk": 8, "fields": {"recipes": 2, "ingredient": 2, "amount": 1.0, "unit": "kg"}}, {"model": "recipes.recipeingredient", "pk": 9, "fields": {"recipes": 2, "ingredient": 11, "amount": 2.0, "unit": "l"}}, {"model": "recipes.recipeingredient", "pk": 10, "fields": {"recipes": 2, "ingredient": 12, "amount": 3.0, "unit": "st"}}, {"model": "recipes.recipeingredient", "pk": 11, "fields": {"recipes": 1, "ingredient": 1, "amount": 1.0, "unit": "kg"}}, {"model": "recipes.recipeingredient", "pk": 12, "fields": {"recipes": 1, "ingredient": 3, "amount": 1.0, "unit": "st"}}, {"model": "ingredients.category", "pk": 1, "fields": {"name": "fruit"}}, {"model": "ingredients.category", "pk": 3, "fields": {"name": "xkcd"}}, {"model": "ingredients.ingredient", "pk": 1, "fields": {"name": "Cheerios", "notes": "this is a note", "category": 3}}, {"model": "ingredients.ingredient", "pk": 2, "fields": {"name": "Quail Eggs", "notes": "has more notes", "category": 3}}, {"model": "ingredients.ingredient", "pk": 3, "fields": {"name": "Vermouth", "notes": "", "category": 3}}, {"model": "ingredients.ingredient", "pk": 4, "fields": {"name": "Skittles", "notes": "", "category": 3}}, {"model": "ingredients.ingredient", "pk": 5, "fields": {"name": "Newt", "notes": "Braised and Confuesd", "category": 3}}, {"model": "ingredients.ingredient", "pk": 6, "fields": {"name": "Doritos", "notes": "Crushed", "category": 3}}, {"model": "ingredients.ingredient", "pk": 7, "fields": {"name": "Apple", "notes": "", "category": 1}}, {"model": "ingredients.ingredient", "pk": 8, "fields": {"name": "Orange", "notes": "", "category": 1}}, {"model": "ingredients.ingredient", "pk": 9, "fields": {"name": "Banana", "notes": "", "category": 1}}, {"model": "ingredients.ingredient", "pk": 10, "fields": {"name": "Grapes", "notes": "", "category": 1}}, {"model": "ingredients.ingredient", "pk": 11, "fields": {"name": "Whipped Cream", "notes": "", "category": 3}}, {"model": "ingredients.ingredient", "pk": 12, "fields": {"name": "MSG", "notes": "", "category": 3}}] \ No newline at end of file diff --git a/examples/cookbook/manage.py b/examples/cookbook/manage.py deleted file mode 100755 index 8d8a34d..0000000 --- a/examples/cookbook/manage.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cookbook.settings") - - from django.core.management import execute_from_command_line - - execute_from_command_line(sys.argv) diff --git a/examples/cookbook/requirements.txt b/examples/cookbook/requirements.txt deleted file mode 100644 index f6d03ff..0000000 --- a/examples/cookbook/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -graphene>=2.1,<3 -graphene-django>=2.1,<3 -graphql-core>=2.1,<3 -django==3.1.8 -django-filter>=2 diff --git a/examples/cookbook/setup.cfg b/examples/cookbook/setup.cfg deleted file mode 100644 index 8c6a6e8..0000000 --- a/examples/cookbook/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[flake8] -exclude=migrations,.git,__pycache__ diff --git a/examples/django_test_settings.py b/examples/django_test_settings.py deleted file mode 100644 index 7b98861..0000000 --- a/examples/django_test_settings.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import os - -ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) -sys.path.insert(0, ROOT_PATH + "/examples/") - -SECRET_KEY = 1 - -INSTALLED_APPS = [ - "graphene_django", - "graphene_django.rest_framework", - "graphene_django.tests", - "examples.starwars", -] - -DATABASES = { - "default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "django_test.sqlite"} -} - -TEMPLATES = [ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], - "APP_DIRS": True, - } -] - -GRAPHENE = {"SCHEMA": "graphene_django.tests.schema_view.schema"} - -ROOT_URLCONF = "graphene_django.tests.urls" diff --git a/examples/starwars/__init__.py b/examples/starwars/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/starwars/data.py b/examples/starwars/data.py deleted file mode 100644 index 6bdbf57..0000000 --- a/examples/starwars/data.py +++ /dev/null @@ -1,70 +0,0 @@ -from .models import Character, Faction, Ship - - -def initialize(): - human = Character(name="Human") - human.save() - - droid = Character(name="Droid") - droid.save() - - rebels = Faction(id="1", name="Alliance to Restore the Republic", hero=human) - rebels.save() - - empire = Faction(id="2", name="Galactic Empire", hero=droid) - empire.save() - - xwing = Ship(id="1", name="X-Wing", faction=rebels) - xwing.save() - - human.ship = xwing - human.save() - - ywing = Ship(id="2", name="Y-Wing", faction=rebels) - ywing.save() - - awing = Ship(id="3", name="A-Wing", faction=rebels) - awing.save() - - # Yeah, technically it's Corellian. But it flew in the service of the rebels, - # so for the purposes of this demo it's a rebel ship. - falcon = Ship(id="4", name="Millenium Falcon", faction=rebels) - falcon.save() - - homeOne = Ship(id="5", name="Home One", faction=rebels) - homeOne.save() - - tieFighter = Ship(id="6", name="TIE Fighter", faction=empire) - tieFighter.save() - - tieInterceptor = Ship(id="7", name="TIE Interceptor", faction=empire) - tieInterceptor.save() - - executor = Ship(id="8", name="Executor", faction=empire) - executor.save() - - -def create_ship(ship_name, faction_id): - new_ship = Ship(name=ship_name, faction_id=faction_id) - new_ship.save() - return new_ship - - -def get_ship(_id): - return Ship.objects.get(id=_id) - - -def get_ships(): - return Ship.objects.all() - - -def get_faction(_id): - return Faction.objects.get(id=_id) - - -def get_rebels(): - return get_faction(1) - - -def get_empire(): - return get_faction(2) diff --git a/examples/starwars/models.py b/examples/starwars/models.py deleted file mode 100644 index 03e06a2..0000000 --- a/examples/starwars/models.py +++ /dev/null @@ -1,33 +0,0 @@ -from __future__ import absolute_import - -from django.db import models - - -class Character(models.Model): - name = models.CharField(max_length=50) - ship = models.ForeignKey( - "Ship", - on_delete=models.CASCADE, - blank=True, - null=True, - related_name="characters", - ) - - def __str__(self): - return self.name - - -class Faction(models.Model): - name = models.CharField(max_length=50) - hero = models.ForeignKey(Character, on_delete=models.CASCADE) - - def __str__(self): - return self.name - - -class Ship(models.Model): - name = models.CharField(max_length=50) - faction = models.ForeignKey(Faction, on_delete=models.CASCADE, related_name="ships") - - def __str__(self): - return self.name diff --git a/examples/starwars/schema.py b/examples/starwars/schema.py deleted file mode 100644 index 4bc26e9..0000000 --- a/examples/starwars/schema.py +++ /dev/null @@ -1,82 +0,0 @@ -import graphene -from graphene import Schema, relay, resolve_only_args -from graphene_django import DjangoConnectionField, DjangoObjectType - -from .data import create_ship, get_empire, get_faction, get_rebels, get_ship, get_ships -from .models import Character as CharacterModel -from .models import Faction as FactionModel -from .models import Ship as ShipModel - - -class Ship(DjangoObjectType): - class Meta: - model = ShipModel - interfaces = (relay.Node,) - fields = "__all__" - - @classmethod - def get_node(cls, info, id): - node = get_ship(id) - return node - - -class Character(DjangoObjectType): - class Meta: - model = CharacterModel - fields = "__all__" - - -class Faction(DjangoObjectType): - class Meta: - model = FactionModel - interfaces = (relay.Node,) - fields = "__all__" - - @classmethod - def get_node(cls, info, id): - return get_faction(id) - - -class IntroduceShip(relay.ClientIDMutation): - class Input: - ship_name = graphene.String(required=True) - faction_id = graphene.String(required=True) - - ship = graphene.Field(Ship) - faction = graphene.Field(Faction) - - @classmethod - def mutate_and_get_payload( - cls, root, info, ship_name, faction_id, client_mutation_id=None - ): - ship = create_ship(ship_name, faction_id) - faction = get_faction(faction_id) - return IntroduceShip(ship=ship, faction=faction) - - -class Query(graphene.ObjectType): - rebels = graphene.Field(Faction) - empire = graphene.Field(Faction) - node = relay.Node.Field() - ships = DjangoConnectionField(Ship, description="All the ships.") - - @resolve_only_args - def resolve_ships(self): - return get_ships() - - @resolve_only_args - def resolve_rebels(self): - return get_rebels() - - @resolve_only_args - def resolve_empire(self): - return get_empire() - - -class Mutation(graphene.ObjectType): - introduce_ship = IntroduceShip.Field() - - -# We register the Character Model because if not would be -# inaccessible for the schema -schema = Schema(query=Query, mutation=Mutation, types=[Ship, Character]) diff --git a/examples/starwars/tests/__init__.py b/examples/starwars/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/starwars/tests/test_connections.py b/examples/starwars/tests/test_connections.py deleted file mode 100644 index 425dce5..0000000 --- a/examples/starwars/tests/test_connections.py +++ /dev/null @@ -1,57 +0,0 @@ -import pytest - -from ..data import initialize -from ..schema import schema - -pytestmark = pytest.mark.django_db - - -def test_correct_fetch_first_ship_rebels(): - initialize() - query = """ - query RebelsShipsQuery { - rebels { - name, - hero { - name - } - ships(first: 1) { - edges { - node { - name - } - } - } - } - } - """ - expected = { - "rebels": { - "name": "Alliance to Restore the Republic", - "hero": {"name": "Human"}, - "ships": {"edges": [{"node": {"name": "X-Wing"}}]}, - } - } - result = schema.execute(query) - assert not result.errors - assert result.data == expected - - -def test_correct_list_characters(): - initialize() - query = """ - query RebelsShipsQuery { - node(id: "U2hpcDox") { - ... on Ship { - name - characters { - name - } - } - } - } - """ - expected = {"node": {"name": "X-Wing", "characters": [{"name": "Human"}]}} - result = schema.execute(query) - assert not result.errors - assert result.data == expected diff --git a/examples/starwars/tests/test_mutation.py b/examples/starwars/tests/test_mutation.py deleted file mode 100644 index e24bf8a..0000000 --- a/examples/starwars/tests/test_mutation.py +++ /dev/null @@ -1,53 +0,0 @@ -import pytest - -from ..data import initialize -from ..schema import schema - -pytestmark = pytest.mark.django_db - - -def test_mutations(): - initialize() - - query = """ - mutation MyMutation { - introduceShip(input:{clientMutationId:"abc", shipName: "Peter", factionId: "1"}) { - ship { - id - name - } - faction { - name - ships { - edges { - node { - id - name - } - } - } - } - } - } - """ - expected = { - "introduceShip": { - "ship": {"id": "U2hpcDo5", "name": "Peter"}, - "faction": { - "name": "Alliance to Restore the Republic", - "ships": { - "edges": [ - {"node": {"id": "U2hpcDox", "name": "X-Wing"}}, - {"node": {"id": "U2hpcDoy", "name": "Y-Wing"}}, - {"node": {"id": "U2hpcDoz", "name": "A-Wing"}}, - {"node": {"id": "U2hpcDo0", "name": "Millenium Falcon"}}, - {"node": {"id": "U2hpcDo1", "name": "Home One"}}, - {"node": {"id": "U2hpcDo5", "name": "Peter"}}, - ] - }, - }, - } - } - result = schema.execute(query) - assert not result.errors - assert result.data == expected diff --git a/examples/starwars/tests/test_objectidentification.py b/examples/starwars/tests/test_objectidentification.py deleted file mode 100644 index 6e04a7b..0000000 --- a/examples/starwars/tests/test_objectidentification.py +++ /dev/null @@ -1,96 +0,0 @@ -import pytest - -from ..data import initialize -from ..schema import schema - -pytestmark = pytest.mark.django_db - - -def test_correctly_fetches_id_name_rebels(): - initialize() - query = """ - query RebelsQuery { - rebels { - id - name - } - } - """ - expected = { - "rebels": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"} - } - result = schema.execute(query) - assert not result.errors - assert result.data == expected - - -def test_correctly_refetches_rebels(): - initialize() - query = """ - query RebelsRefetchQuery { - node(id: "RmFjdGlvbjox") { - id - ... on Faction { - name - } - } - } - """ - expected = { - "node": {"id": "RmFjdGlvbjox", "name": "Alliance to Restore the Republic"} - } - result = schema.execute(query) - assert not result.errors - assert result.data == expected - - -def test_correctly_fetches_id_name_empire(): - initialize() - query = """ - query EmpireQuery { - empire { - id - name - } - } - """ - expected = {"empire": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}} - result = schema.execute(query) - assert not result.errors - assert result.data == expected - - -def test_correctly_refetches_empire(): - initialize() - query = """ - query EmpireRefetchQuery { - node(id: "RmFjdGlvbjoy") { - id - ... on Faction { - name - } - } - } - """ - expected = {"node": {"id": "RmFjdGlvbjoy", "name": "Galactic Empire"}} - result = schema.execute(query) - assert not result.errors - assert result.data == expected - - -def test_correctly_refetches_xwing(): - initialize() - query = """ - query XWingRefetchQuery { - node(id: "U2hpcDox") { - id - ... on Ship { - name - } - } - } - """ - expected = {"node": {"id": "U2hpcDox", "name": "X-Wing"}} - result = schema.execute(query) - assert not result.errors - assert result.data == expected