-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Matatika/feature/support-key-properties-se…
…tting Feature/support key properties setting
- Loading branch information
Showing
5 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Tests tap setting key_properties.""" | ||
|
||
import unittest | ||
|
||
import responses | ||
|
||
from tap_google_sheets.tap import TapGoogleSheets | ||
|
||
|
||
class TestKeyPropertiesSetting(unittest.TestCase): | ||
"""Test class for tap setting key_properties""" | ||
|
||
def setUp(self): | ||
self.mock_config = { | ||
"oauth_credentials": { | ||
"client_id": "123", | ||
"client_secret": "123", | ||
"refresh_token": "123", | ||
}, | ||
"sheet_id": "12345", | ||
} | ||
self.mock_config["key_properties"] = ["column_one", "column_two"] | ||
|
||
@responses.activate() | ||
def test_key_properties_being_set_in_stream(self): | ||
"""""" | ||
self.column_response = {"values": [["Column One", "Column Two"], ["1", "1"]]} | ||
|
||
responses.add( | ||
responses.POST, | ||
"https://oauth2.googleapis.com/token", | ||
json={"access_token": "new_token"}, | ||
status=200, | ||
), | ||
responses.add( | ||
responses.GET, | ||
"https://www.googleapis.com/drive/v2/files/12345", | ||
json={"title": "File Name One"}, | ||
status=200, | ||
), | ||
responses.add( | ||
responses.GET, | ||
"https://sheets.googleapis.com/v4/spreadsheets/12345/values/!1:1", | ||
json={ | ||
"range": "!1:1", | ||
"values": [["Column One", "Column Two"]], | ||
}, | ||
status=200, | ||
) | ||
|
||
tap = TapGoogleSheets(config=self.mock_config) | ||
|
||
# Assert that key_properties in tap streams equal to the setting key_properties | ||
for stream in tap.catalog_dict.get("streams"): | ||
self.assertEquals( | ||
stream.get("key_properties"), tap.config.get("key_properties") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters