def test_ensure_profile_no_profile_if_not_staff(self): george = User(username='******') george.has_perm = Mock() george.has_perm.return_value = True signals.ensure_profile(sender=george.__class__, instance=george) with self.assertRaises(Profile.DoesNotExist): george.profile
def test_ensure_profile_preserve_existent(self): self.john.profile.about = 'kogeyHuvyai' signals.ensure_profile(sender=self.john.__class__, instance=self.john) self.assertEqual(self.john.profile.about, 'kogeyHuvyai')