Skip to content

Commit

Permalink
Add unittests taht return us to 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller committed Dec 18, 2018
1 parent c8a5431 commit a520c0d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions opal/tests/test_core_fields.py
Expand Up @@ -68,6 +68,10 @@ def test_unset_value(self):
demographics.save()
self.assertEqual('', demographics.title)

def test_get_default_when_callable(self):
field = ForeignKeyOrFreeText(test_models.Demographics, default=lambda: 'Nope')
self.assertEqual('Nope', field.get_default())

def test_synonyms_addition(self):
ct = ContentType.objects.get_for_model(
test_models.Dog
Expand Down
28 changes: 28 additions & 0 deletions opal/tests/test_models.py
Expand Up @@ -826,3 +826,31 @@ def test_get_footer(self):
ExternalSubRecord.get_modal_footer_template(),
"partials/_sourced_modal_footer.html"
)


class ContactNumberTestCase(OpalTestCase):

def test_str(self):
c = models.ContactNumber(name='Jane Doe', number='0777383828')
self.assertEqual('Jane Doe: 0777383828', c.__str__())


class SynonymTestCase(OpalTestCase):

def test_str(self):
s = models.Synonym(name='Name')
self.assertEqual('Name', s.__str__())


class MacroTestCase(OpalTestCase):

def test_str(self):
m = models.Macro(title='My Macro')
self.assertEqual('My Macro', m.__str__())


class RoleTestCase(OpalTestCase):

def test_str(self):
r = models.Role(name='Doctor')
self.assertEqual('Doctor', r.__str__())

0 comments on commit a520c0d

Please sign in to comment.