From caf024d75ee3928fbd2f52b0af06c7b7dc578222 Mon Sep 17 00:00:00 2001 From: fredkingham Date: Wed, 11 Oct 2017 18:18:31 +0100 Subject: [PATCH] adds unit tests around enum field descriptions --- opal/models.py | 2 +- opal/tests/models.py | 2 -- opal/tests/test_models_mixins.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/opal/models.py b/opal/models.py index 1911bb9ec..cf17b6670 100644 --- a/opal/models.py +++ b/opal/models.py @@ -235,7 +235,7 @@ def get_field_description(cls, name): enum = cls.get_field_enum(name) if enum: - return "One of {}".format(",".join([force_str(e) for e in enum])) + return "One of {}".format(", ".join([force_str(e) for e in enum])) related_fields = ( models.ForeignKey, models.ManyToManyField, diff --git a/opal/tests/models.py b/opal/tests/models.py index 53d5e51fd..b47fe64e5 100644 --- a/opal/tests/models.py +++ b/opal/tests/models.py @@ -137,7 +137,6 @@ class FavouriteColour(models.PatientSubrecord): _is_singleton = True name = dmodels.CharField( max_length=200, blank=True, null=True, choices=COLOUR_CHOICES, - help_text="orange is the new black" ) @@ -173,7 +172,6 @@ class Location(models.EpisodeSubrecord): bed = dmodels.CharField(max_length=200, blank=True, null=True) - if not getattr(models.Episode, 'symptoms', None): class SymptomComplex(models.SymptomComplex): pass diff --git a/opal/tests/test_models_mixins.py b/opal/tests/test_models_mixins.py index 3f57c49c5..f7e51459d 100644 --- a/opal/tests/test_models_mixins.py +++ b/opal/tests/test_models_mixins.py @@ -149,7 +149,7 @@ def test_description(self): def test_description_enum(self): description = test_models.FavouriteColour.get_field_description('name') - self.assertEqual(description, "orange is the new black") + self.assertEqual(description, "One of purple, yellow, blue") def test_build_field_schema(self): schema = SerialisableModel.build_field_schema()