예제 #1
0
def test_salesforce_connection_sandbox_omitted():
    environment = {
        'SALESFORCE_USERNAME': '******',
        'SALESFORCE_PASSWORD': '******',
        'SALESFORCE_SECURITY_TOKEN': 'token123',
        'SALESFORCE_INSTANCE': 'foo.example.com'
    }
    with override_environment(**environment), \
         mock.patch('salesforce_bulk_api.Salesforce') as Salesforce:

        session = salesforce_bulk_api.salesforce_session()
        assert session == Salesforce.return_value
        Salesforce.assert_called_with(username='******',
                                      password='******',
                                      security_token='token123',
                                      instance='foo.example.com',
                                      sandbox=False,
                                      version='34.0')
def test_salesforce_connection_sandbox_omitted():
    environment = {
        "SALESFORCE_USERNAME": "******",
        "SALESFORCE_PASSWORD": "******",
        "SALESFORCE_SECURITY_TOKEN": "token123",
        "SALESFORCE_INSTANCE": "foo.example.com",
    }
    with override_environment(**environment), mock.patch("salesforce_bulk_api.Salesforce") as Salesforce:

        session = salesforce_bulk_api.salesforce_session()
        assert session == Salesforce.return_value
        Salesforce.assert_called_with(
            username="******",
            password="******",
            security_token="token123",
            instance="foo.example.com",
            sandbox=False,
            sf_version="34.0",
        )