def test_load_traps_login_exceptions(self):
        mock_conn = Mock()
        return_exception = simple_salesforce.SalesforceAuthenticationFailed(
            500, "Internal Server Error")
        mock_conn.get_global_describe = Mock(side_effect=return_exception)

        ex = {
            "version":
            1,
            "operation": [{
                "sobject": "Account",
                "field-group": "writeable",
                "extract": {
                    "all": True
                },
            }],
        }
        self._run_error_validating_test(
            ex,
            [
                "Unable to authenticate to Salesforce: {}".format(
                    return_exception)
            ],
            mock_conn,
        )
Example #2
0
    def test_load_load_operation_traps_login_exceptions(self, sf_mock):
        return_exception = simple_salesforce.SalesforceAuthenticationFailed(500, 'Internal Server Error')
        sf_mock.describe = Mock(side_effect=return_exception)
        context = amaxa.LoadOperation(sf_mock)
        ex = {
            'version': 1,
            'operation': [
                { 
                    'sobject': 'Account',
                    'field-group': 'writeable',
                    'extract': { 'all': True }
                }
            ]
        }

        (result, errors) = loader.load_load_operation(ex, context)

        self.assertIsNone(result)
        self.assertEqual(['Unable to authenticate to Salesforce: {}'.format(return_exception)], errors)