def test_profile_complete3(self): """Profile is complete when matnum, first_name and last_name are not empty.""" StudentDetails.objects.create(user=self.sarah, matnum='1234567') self.assertTrue(self.sarah.studentdetails) self.sarah.first_name = 'Sarah' self.sarah.last_name = 'Connor' self.sarah.save() self.assertTrue(user_profile_complete(self.sarah))
def test_profile_complete3(self): """Profile is complete when matnum, first_name and last_name are not empty.""" StudentDetails.objects.create(user=self.sarah, matnum="1234567") self.assertTrue(self.sarah.studentdetails) self.sarah.first_name = "Sarah" self.sarah.last_name = "Connor" self.sarah.save() self.assertTrue(user_profile_complete(self.sarah))
def test_profile_complete2(self): """Profile is not complete when matnum, first_name or last_name fields are empty.""" StudentDetails.objects.create(user=self.sarah) self.assertTrue(self.sarah.studentdetails) self.assertFalse(user_profile_complete(self.sarah))
def test_profile_complete1(self): """Profile is not complete when related StudentDetails object is missing.""" with self.assertRaises(User.studentdetails.RelatedObjectDoesNotExist): self.sarah.studentdetails self.assertFalse(user_profile_complete(self.sarah))