Skip to content

Commit

Permalink
bumping simple-salesforce to 1.0.0 (#7857)
Browse files Browse the repository at this point in the history
  • Loading branch information
eladkal authored Mar 26, 2020
1 parent 6486abc commit 9546192
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ https://developers.google.com/style/inclusive-documentation
-->

### Changes to SalesforceHook

Replace parameter ``sandbox`` with ``domain``. According to change in simple-salesforce package

### Rename parameter name in PinotAdminHook.create_segment

Rename parameter name from ``format`` to ``segment_format`` in PinotAdminHook function create_segment fro pylint compatible
Expand Down
4 changes: 3 additions & 1 deletion airflow/providers/salesforce/hooks/salesforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class SalesforceHook(BaseHook):
We need a user's security token to connect to Salesforce.
So we define it in the `Extras` field as `{"security_token":"YOUR_SECURITY_TOKEN"}`
For sandbox mode, add `{"domain":"test"}` in the `Extras` field
"""

def __init__(self, conn_id):
Expand All @@ -69,7 +71,7 @@ def get_conn(self):
password=connection.password,
security_token=extras['security_token'],
instance_url=connection.host,
sandbox=extras.get('sandbox', False)
domain=extras.get('domain', None)
)
return self.conn

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version
'redis~=3.2',
]
salesforce = [
'simple-salesforce>=0.72,<1.0.0',
'simple-salesforce>=1.0.0',
]
samba = [
'pysmbclient>=0.1.3',
Expand Down
4 changes: 2 additions & 2 deletions tests/providers/salesforce/hooks/test_salesforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_get_conn_exists(self):
@patch(
"airflow.providers.salesforce.hooks.salesforce.SalesforceHook.get_connection",
return_value=Connection(
login="username", password="password", extra='{"security_token": "token", "sandbox": "true"}'
login="username", password="password", extra='{"security_token": "token", "domain": "test"}'
),
)
@patch("airflow.providers.salesforce.hooks.salesforce.Salesforce")
Expand All @@ -54,7 +54,7 @@ def test_get_conn(self, mock_salesforce, mock_get_connection):
password=mock_get_connection.return_value.password,
security_token=mock_get_connection.return_value.extra_dejson["security_token"],
instance_url=mock_get_connection.return_value.host,
sandbox=mock_get_connection.return_value.extra_dejson.get("sandbox", False),
domain=mock_get_connection.return_value.extra_dejson.get("domain", None),
)

@patch("airflow.providers.salesforce.hooks.salesforce.Salesforce")
Expand Down

0 comments on commit 9546192

Please sign in to comment.