From 8744f6a90ea1861e001cc60e3f991677b42b5255 Mon Sep 17 00:00:00 2001 From: Ian Foote Date: Thu, 26 May 2016 15:44:49 +0100 Subject: [PATCH] Add test for django choices with translation --- graphene/contrib/django/tests/test_converter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/graphene/contrib/django/tests/test_converter.py b/graphene/contrib/django/tests/test_converter.py index f5d98e63..32855599 100644 --- a/graphene/contrib/django/tests/test_converter.py +++ b/graphene/contrib/django/tests/test_converter.py @@ -1,5 +1,6 @@ import pytest from django.db import models +from django.utils.translation import ugettext_lazy as _ from py.test import raises import graphene @@ -117,6 +118,21 @@ def test_field_with_choices_convert_enum(): assert graphene_type.__enum__.__members__['ENGLISH'].value == 'en' +def test_field_with_choices_gettext(): + field = models.CharField(help_text='Language', choices=( + ('es', _('Spanish')), + ('en', _('English')) + )) + + class TranslatedModel(models.Model): + language = field + + class Meta: + app_label = 'test' + + convert_django_field_with_choices(field) + + def test_should_float_convert_float(): assert_conversion(models.FloatField, graphene.Float)