def METHOD_NAME(self):
    recipient = "expired@a.com"
    code = Code.create_for_user(user=self.new_user, recipient=recipient, length=settings.AUTH_CODE_LENGTH)
    code.expires_at = datetime.utcnow() - timedelta(seconds=1)
    code.save()
    with self.assertRaises(InvalidCode):
        Code.check_code(recipient=recipient, code=code.code)