Skip to content

Commit

Permalink
adds unit tests around enum field descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Oct 11, 2017
1 parent fb2821f commit caf024d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion opal/models.py
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions opal/tests/models.py
Expand Up @@ -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"
)


Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion opal/tests/test_models_mixins.py
Expand Up @@ -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()
Expand Down

0 comments on commit caf024d

Please sign in to comment.