def for_user(self, user): user_type = determine_user_type(user) if user_type is None: return None return UserType.objects.filter(user_type=user_type, is_active=True).first()
def assert_user_type(self, expected, user): """Handle details of determining and checking user_type.""" self.assertEqual(expected, determine_user_type(user))