From 47c54df74132a9d8811e7e9ecf049b43188b0998 Mon Sep 17 00:00:00 2001 From: Pavel Jezek Date: Wed, 17 Jan 2024 12:45:30 +0100 Subject: [PATCH] chore: update test to assert multiple whitespace cases --- .../tests/test_underscoring_column_names.py | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tap_google_sheets/tests/test_underscoring_column_names.py b/tap_google_sheets/tests/test_underscoring_column_names.py index c1f0c40..cb50276 100644 --- a/tap_google_sheets/tests/test_underscoring_column_names.py +++ b/tap_google_sheets/tests/test_underscoring_column_names.py @@ -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 @@ -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, @@ -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( @@ -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", + }, )