Esempio n. 1
0
 def login_password_exports_temporary_error(self, auth_state):
     """Login for a user who hasn't been OFAC verified yet"""
     with override_settings(**get_cybersource_test_settings()), patch(
             "authentication.pipeline.compliance.api.verify_user_with_exports",
             side_effect=Exception(
                 "register_details_export_temporary_error"),
     ):
         assert_api_call(
             self.client,
             "psa-login-password",
             {
                 "flow": auth_state["flow"],
                 "partial_token": auth_state["partial_token"],
                 "password": self.password,
             },
             {
                 "flow":
                 auth_state["flow"],
                 "partial_token":
                 None,
                 "state":
                 SocialAuthState.STATE_ERROR_TEMPORARY,
                 "errors": [
                     "Unable to register at this time, please try again later"
                 ],
             },
         )
Esempio n. 2
0
def export_check_response(response_name):
    """Context manager for configuring export check responses"""
    with override_settings(**get_cybersource_test_settings()
                           ), responses.RequestsMock() as mocked_responses:
        mock_cybersource_wsdl(mocked_responses, settings)
        mock_cybersource_wsdl_operation(mocked_responses, response_name)
        yield
Esempio n. 3
0
 def register_details_export_temporary_error(self, auth_state):
     """Complete the register confirmation details page with exports raising a temporary error"""
     with override_settings(**get_cybersource_test_settings()), patch(
         "authentication.pipeline.compliance.api.verify_user_with_exports",
         side_effect=Exception("register_details_export_temporary_error"),
     ):
         assert_api_call(
             self.client,
             "psa-register-details",
             {
                 "flow": auth_state["flow"],
                 "partial_token": auth_state["partial_token"],
                 "password": self.password,
                 "name": "Sally Smith",
                 "legal_address": {
                     "first_name": "Sally",
                     "last_name": "Smith",
                     "street_address": ["Main Street"],
                     "country": "US",
                     "state_or_territory": "US-CO",
                     "city": "Boulder",
                     "postal_code": "02183",
                 },
             },
             {
                 "flow": auth_state["flow"],
                 "partial_token": None,
                 "errors": [
                     "Unable to register at this time, please try again later"
                 ],
                 "state": SocialAuthState.STATE_ERROR_TEMPORARY,
             },
         )
         assert not ExportsInquiryLog.objects.filter(user__email=self.email).exists()
         assert len(mail.outbox) == 0
Esempio n. 4
0
def cybersource_settings(settings, cybersource_private_key):
    """Configured CyberSource settings"""
    for attr_name, value in get_cybersource_test_settings(
            cybersource_private_key).items():
        setattr(settings, attr_name, value)
    return settings