diff --git a/airbyte-integrations/connectors/source-salesforce/integration_tests/integration_test.py b/airbyte-integrations/connectors/source-salesforce/integration_tests/integration_test.py index 1d843fdfe5c5..9eca8f43a0ed 100644 --- a/airbyte-integrations/connectors/source-salesforce/integration_tests/integration_test.py +++ b/airbyte-integrations/connectors/source-salesforce/integration_tests/integration_test.py @@ -7,6 +7,7 @@ import time from datetime import datetime from pathlib import Path +from typing import Dict import pendulum import pytest @@ -39,6 +40,10 @@ def sf(input_sandbox_config): return sf +def _authentication_headers(salesforce: Salesforce) -> Dict[str, str]: + return {"Authorization": f"Bearer {salesforce.access_token}"} + + @pytest.fixture(scope="module") def stream_name(): return "ContentNote" @@ -75,8 +80,8 @@ def get_stream_state(): return {"LastModifiedDate": pendulum.now(tz="UTC").add(days=-1).isoformat(timespec="milliseconds")} -def test_update_for_deleted_record(stream): - headers = stream.authenticator.get_auth_header() +def test_update_for_deleted_record(stream, sf): + headers = _authentication_headers(sf) stream_state = get_stream_state() time.sleep(1) response = create_note(stream, headers) @@ -138,8 +143,8 @@ def test_update_for_deleted_record(stream): assert response.status_code == 404, "Expected an update to a deleted note to return 404" -def test_deleted_record(stream): - headers = stream.authenticator.get_auth_header() +def test_deleted_record(stream, sf): + headers = _authentication_headers(sf) response = create_note(stream, headers) assert response.status_code == 201, "Note was note created" diff --git a/airbyte-integrations/connectors/source-salesforce/source_salesforce/streams.py b/airbyte-integrations/connectors/source-salesforce/source_salesforce/streams.py index 0b9bdd279905..c6f5853fd67f 100644 --- a/airbyte-integrations/connectors/source-salesforce/source_salesforce/streams.py +++ b/airbyte-integrations/connectors/source-salesforce/source_salesforce/streams.py @@ -705,7 +705,7 @@ def get_standard_instance(self) -> SalesforceStream: stream_name=self.stream_name, schema=self.schema, sobject_options=self.sobject_options, - authenticator=self.authenticator, + authenticator=self._session.auth, ) new_cls: Type[SalesforceStream] = RestSalesforceStream if isinstance(self, BulkIncrementalSalesforceStream):