def test_home_under_2fa_with_otp_device(self) -> None:
    with self.settings(TWO_FACTOR_AUTHENTICATION_ENABLED=True):
        user_profile = self.example_user('iago')
        self.create_default_device(user_profile)
        self.login(user_profile.email)
        result = self._get_home_page()
        self.assertEqual(result.status_code, 302)
        self.login_2fa(user_profile)
        result = self._get_home_page()
        self.assertEqual(result.status_code, 200)
def test_home_under_2fa_with_otp_device(self) -> None:
    with self.settings(TWO_FACTOR_AUTHENTICATION_ENABLED=True):
        user_profile = self.example_user('iago')
        self.create_default_device(user_profile)
        self.login(user_profile.email)
        result = self._get_home_page()
        self.assertEqual(result.status_code, 302)
        self.login_2fa(user_profile)
        result = self._get_home_page()
        self.assertEqual(result.status_code, 200)