Skip to content

Commit

Permalink
chore: update test to assert multiple whitespace cases
Browse files Browse the repository at this point in the history
  • Loading branch information
srpwnd committed Jan 17, 2024
1 parent 3829542 commit 47c54df
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions tap_google_sheets/tests/test_underscoring_column_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import unittest

import responses
import json
import singer_sdk._singerlib as singer

import tap_google_sheets.tests.utils as test_utils
Expand All @@ -22,7 +23,20 @@ def setUp(self):

@responses.activate()
def test_underscoring_column_names(self):
self.column_response = {"values": [["Column One", "Column Two"], ["1", "1"]]}
self.column_response = {
"values": [
[
"Column One",
" Column Two",
" Column Three ",
"Column\nFour",
"Column \n\tFive\n\n\t ",
"Multi Column One",
" Multi Column Two ",
"\tMulti \r\nColumn\f\vThree",
], ["1"] * 8
]
}

responses.add(
responses.POST,
Expand All @@ -39,7 +53,7 @@ def test_underscoring_column_names(self):
responses.add(
responses.GET,
"https://sheets.googleapis.com/v4/spreadsheets/12345/values/!1:1",
json={"range": "Sheet1!1:1", "values": [["Column_One", "Column_Two"]]},
json={"range": "Sheet1!1:1", "values": [self.column_response["values"][0]]},
status=200,
),
responses.add(
Expand All @@ -61,5 +75,15 @@ def test_underscoring_column_names(self):

# Assert that column names have been underscored
self.assertEquals(
test_utils.SINGER_MESSAGES[2].record, {"Column_One": "1", "Column_Two": "1"}
test_utils.SINGER_MESSAGES[2].record,
{
"Column_One": "1",
"Column_Two": "1",
"Column_Three": "1",
"Column_Four": "1",
"Column_Five": "1",
"Multi_Column_One": "1",
"Multi_Column_Two": "1",
"Multi_Column_Three": "1",
},
)

0 comments on commit 47c54df

Please sign in to comment.