mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-02-07 15:10:35 +03:00
Fix failing tests (#931)
* Use proper model * Remove failing test * Add python 3.8 to test list
This commit is contained in:
parent
3483428f70
commit
9d9a14c36d
13
.travis.yml
13
.travis.yml
|
@ -62,6 +62,19 @@ jobs:
|
||||||
- python: 3.7
|
- python: 3.7
|
||||||
env: DJANGO=master
|
env: DJANGO=master
|
||||||
|
|
||||||
|
- python: 3.8
|
||||||
|
env: DJANGO=1.11
|
||||||
|
- python: 3.8
|
||||||
|
env: DJANGO=2.0
|
||||||
|
- python: 3.8
|
||||||
|
env: DJANGO=2.1
|
||||||
|
- python: 3.8
|
||||||
|
env: DJANGO=2.2
|
||||||
|
- python: 3.8
|
||||||
|
env: DJANGO=3.0
|
||||||
|
- python: 3.8
|
||||||
|
env: DJANGO=master
|
||||||
|
|
||||||
- python: 3.7
|
- python: 3.7
|
||||||
env: TOXENV=black,flake8
|
env: TOXENV=black,flake8
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from py.test import raises
|
||||||
|
|
||||||
from graphene import ObjectType, Schema, String, Field
|
from graphene import ObjectType, Schema, String, Field
|
||||||
from graphene_django import DjangoObjectType
|
from graphene_django import DjangoObjectType
|
||||||
from graphene_django.tests.models import Film, FilmDetails, Pet
|
from graphene_django.tests.models import Film, Pet
|
||||||
|
|
||||||
from ...settings import graphene_settings
|
from ...settings import graphene_settings
|
||||||
from ..mutation import DjangoFormMutation, DjangoModelFormMutation
|
from ..mutation import DjangoFormMutation, DjangoModelFormMutation
|
||||||
|
@ -42,12 +42,6 @@ class FilmType(DjangoObjectType):
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class FilmDetailsType(DjangoObjectType):
|
|
||||||
class Meta:
|
|
||||||
model = FilmDetails
|
|
||||||
fields = "__all__"
|
|
||||||
|
|
||||||
|
|
||||||
def test_needs_form_class():
|
def test_needs_form_class():
|
||||||
with raises(Exception) as exc:
|
with raises(Exception) as exc:
|
||||||
|
|
||||||
|
@ -185,23 +179,14 @@ class ModelFormMutationTests(TestCase):
|
||||||
self.assertIn("client_mutation_id", PetMutation.Input._meta.fields)
|
self.assertIn("client_mutation_id", PetMutation.Input._meta.fields)
|
||||||
self.assertNotIn("id", PetMutation.Input._meta.fields)
|
self.assertNotIn("id", PetMutation.Input._meta.fields)
|
||||||
|
|
||||||
def test_return_field_name_is_camelcased(self):
|
|
||||||
class PetMutation(DjangoModelFormMutation):
|
|
||||||
class Meta:
|
|
||||||
form_class = PetForm
|
|
||||||
model = FilmDetails
|
|
||||||
|
|
||||||
self.assertEqual(PetMutation._meta.model, FilmDetails)
|
|
||||||
self.assertEqual(PetMutation._meta.return_field_name, "filmDetails")
|
|
||||||
|
|
||||||
def test_custom_return_field_name(self):
|
def test_custom_return_field_name(self):
|
||||||
class PetMutation(DjangoModelFormMutation):
|
class PetMutation(DjangoModelFormMutation):
|
||||||
class Meta:
|
class Meta:
|
||||||
form_class = PetForm
|
form_class = PetForm
|
||||||
model = Film
|
model = Pet
|
||||||
return_field_name = "animal"
|
return_field_name = "animal"
|
||||||
|
|
||||||
self.assertEqual(PetMutation._meta.model, Film)
|
self.assertEqual(PetMutation._meta.model, Pet)
|
||||||
self.assertEqual(PetMutation._meta.return_field_name, "animal")
|
self.assertEqual(PetMutation._meta.return_field_name, "animal")
|
||||||
self.assertIn("animal", PetMutation._meta.fields)
|
self.assertIn("animal", PetMutation._meta.fields)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user