mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 17:17:02 +02:00
updated tests
This commit is contained in:
parent
1fa0e63126
commit
673c092ea9
3 changed files with 22 additions and 12 deletions
|
@ -94,12 +94,7 @@ class Contact(TimeStampedModel):
|
|||
return " ".join(names) if names else "Unknown"
|
||||
|
||||
def has_contact_info(self):
|
||||
has_contact_info = (
|
||||
self.title or
|
||||
self.email or
|
||||
self.phone
|
||||
)
|
||||
return has_contact_info
|
||||
return bool(self.title or self.email or self.phone)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
# Call the parent class's save method to perform the actual save
|
||||
|
|
|
@ -93,12 +93,7 @@ class User(AbstractUser):
|
|||
return self.domain_requests_created.filter(status=DomainRequest.DomainRequestStatus.INELIGIBLE).count()
|
||||
|
||||
def has_contact_info(self):
|
||||
has_contact_info = (
|
||||
self.contact.title or
|
||||
self.email.title or
|
||||
self.contact.phone
|
||||
)
|
||||
return has_contact_info
|
||||
return bool(self.contact.title or self.contact.email or self.contact.phone)
|
||||
|
||||
@classmethod
|
||||
def needs_identity_verification(cls, email, uuid):
|
||||
|
|
|
@ -1137,6 +1137,16 @@ class TestUser(TestCase):
|
|||
)
|
||||
self.assertEquals(self.user.get_ineligible_requests_count(), 1)
|
||||
|
||||
def test_has_contact_info(self):
|
||||
"""Test that has_contact_info properly returns"""
|
||||
# test with a user with contact info defined
|
||||
self.assertTrue(self.user.has_contact_info())
|
||||
# test with a user without contact info defined
|
||||
self.user.contact.title = None
|
||||
self.user.contact.email = None
|
||||
self.user.contact.phone = None
|
||||
self.assertFalse(self.user.has_contact_info())
|
||||
|
||||
|
||||
class TestContact(TestCase):
|
||||
def setUp(self):
|
||||
|
@ -1238,3 +1248,13 @@ class TestContact(TestCase):
|
|||
# test for a contact which is assigned as an authorizing official on a domain request
|
||||
self.assertFalse(self.contact_as_ao.has_more_than_one_join("authorizing_official"))
|
||||
self.assertTrue(self.contact_as_ao.has_more_than_one_join("submitted_domain_requests"))
|
||||
|
||||
def test_has_contact_info(self):
|
||||
"""Test that has_contact_info properly returns"""
|
||||
# test with a contact with contact info defined
|
||||
self.assertTrue(self.contact.has_contact_info())
|
||||
# test with a contact without contact info defined
|
||||
self.contact.title = None
|
||||
self.contact.email = None
|
||||
self.contact.phone = None
|
||||
self.assertFalse(self.contact.has_contact_info())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue