From 2e3e96632d9c8dd968c46ea500ddbd39fab15399 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:14:32 +0100 Subject: [PATCH 01/11] add local state test assertions (this does not add any new requests, so no new cassettes need to be recorded :) --- tests/worksheet_test.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index 2d08f91a9..b3055390f 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -243,25 +243,25 @@ def get_grid_props(): self.sheet.add_rows(add_num) grid_props = get_grid_props() - self.assertEqual(grid_props["rowCount"], new_rows) + self.assertEqual(self.sheet.row_count, new_rows) new_cols = self.sheet.col_count + add_num - self.sheet.add_cols(add_num) grid_props = get_grid_props() - self.assertEqual(grid_props["columnCount"], new_cols) + self.assertEqual(self.sheet.col_count, new_cols) new_rows -= add_num new_cols -= add_num self.sheet.resize(new_rows, new_cols) grid_props = get_grid_props() - self.assertEqual(grid_props["rowCount"], new_rows) self.assertEqual(grid_props["columnCount"], new_cols) + self.assertEqual(self.sheet.row_count, new_rows) + self.assertEqual(self.sheet.col_count, new_cols) @pytest.mark.vcr() def test_sort(self): @@ -331,21 +331,22 @@ def get_grid_props(): self.sheet.freeze(freeze_rows) grid_props = get_grid_props() - self.assertEqual(grid_props["frozenRowCount"], freeze_rows) + self.assertEqual(self.sheet.frozen_row_count, freeze_rows) self.sheet.freeze(cols=freeze_cols) grid_props = get_grid_props() - self.assertEqual(grid_props["frozenColumnCount"], freeze_cols) + self.assertEqual(self.sheet.frozen_col_count, freeze_cols) self.sheet.freeze(0, 0) grid_props = get_grid_props() - self.assertTrue("frozenRowCount" not in grid_props) self.assertTrue("frozenColumnCount" not in grid_props) + self.assertEqual(self.sheet.frozen_row_count, 0) + self.assertEqual(self.sheet.frozen_col_count, 0) @pytest.mark.vcr() def test_basic_filters(self): @@ -965,6 +966,7 @@ def test_worksheet_update_index(self): last_sheet.update_index(0) w = self.spreadsheet.worksheets() self.assertEqual(w[0].id, last_sheet.id) + self.assertEuql(last_sheet.index, 0) @pytest.mark.vcr() def test_worksheet_notes(self): @@ -1090,18 +1092,25 @@ def test_hide_show_worksheet(self): # if missing => value is False res = self.spreadsheet.fetch_sheet_metadata() before_hide = res["sheets"][1]["properties"].get("hidden", False) + before_hide_prop = self.sheet.isSheetHidden + self.assertFalse(before_hide) + self.assertFalse(before_hide_prop) new_sheet.hide() res = self.spreadsheet.fetch_sheet_metadata() after_hide = res["sheets"][1]["properties"].get("hidden", False) + after_hide_prop = self.sheet.isSheetHidden self.assertTrue(after_hide) + self.assertTrue(after_hide_prop) new_sheet.show() + res = self.spreadsheet.fetch_sheet_metadata() before_hide = res["sheets"][1]["properties"].get("hidden", False) self.assertFalse(before_hide) + self.assertFalse(before_hide_prop) @pytest.mark.vcr() def test_hide_gridlines(self): From c7b211d8255e432c27622c46f80f6caae3f87bfb Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:19:34 +0100 Subject: [PATCH 02/11] add test_update_title --- .../WorksheetTest.test_update_title.json | 612 ++++++++++++++++++ tests/worksheet_test.py | 18 + 2 files changed, 630 insertions(+) create mode 100644 tests/cassettes/WorksheetTest.test_update_title.json diff --git a/tests/cassettes/WorksheetTest.test_update_title.json b/tests/cassettes/WorksheetTest.test_update_title.json new file mode 100644 index 000000000..4911739ca --- /dev/null +++ b/tests/cassettes/WorksheetTest.test_update_title.json @@ -0,0 +1,612 @@ +{ + "version": 1, + "interactions": [ + { + "request": { + "method": "POST", + "uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", + "body": "{\"name\": \"Test WorksheetTest test_update_title\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "Content-Length": [ + "103" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "Pragma": [ + "no-cache" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:54 GMT" + ], + "content-length": [ + "190" + ] + }, + "body": { + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0\",\n \"name\": \"Test WorksheetTest test_update_title\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-XSS-Protection": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:54 GMT" + ], + "content-length": [ + "3334" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_title\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-XSS-Protection": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:54 GMT" + ], + "content-length": [ + "3334" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_title\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0/values/%27Sheet1%27:clear", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-XSS-Protection": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:54 GMT" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-XSS-Protection": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:55 GMT" + ], + "content-length": [ + "3334" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_title\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0:batchUpdate", + "body": "{\"requests\": [{\"updateSheetProperties\": {\"properties\": {\"sheetId\": 0, \"title\": \"I'm a new title\"}, \"fields\": \"title\"}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "Content-Length": [ + "120" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-XSS-Protection": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:55 GMT" + ], + "content-length": [ + "97" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0\",\n \"replies\": [\n {}\n ]\n}\n" + } + } + }, + { + "request": { + "method": "GET", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0?includeGridData=false", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-XSS-Protection": [ + "0" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Cache-Control": [ + "private" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:55 GMT" + ], + "content-length": [ + "3343" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_update_title\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"I'm a new title\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0/edit\"\n}\n" + } + } + }, + { + "request": { + "method": "DELETE", + "uri": "https://www.googleapis.com/drive/v3/files/1RxLzKx6dK-PYusYSVAJ_klC93OTTqaYv9KvsEby-lG0?supportsAllDrives=True", + "body": null, + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "Content-Length": [ + "0" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 204, + "message": "No Content" + }, + "headers": { + "Content-Type": [ + "text/html" + ], + "Vary": [ + "Origin, X-Origin" + ], + "Server": [ + "ESF" + ], + "X-XSS-Protection": [ + "0" + ], + "Pragma": [ + "no-cache" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Date": [ + "Wed, 07 Jun 2023 22:17:56 GMT" + ], + "Content-Length": [ + "0" + ] + }, + "body": { + "string": "" + } + } + } + ] +} diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index b3055390f..74f24debc 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -166,6 +166,24 @@ def test_update_cells_unicode(self): cell = self.sheet.cell(1, 1) self.assertEqual(cell.value, I18N_STR) + @pytest.mark.vcr() + def test_update_title(self): + res = self.spreadsheet.fetch_sheet_metadata() + title_before = res["sheets"][0]["properties"]["title"] + title_before_prop = self.sheet.title + + new_title = "I'm a new title" + self.sheet.update_title(new_title) + + res = self.spreadsheet.fetch_sheet_metadata() + title_after = res["sheets"][0]["properties"]["title"] + title_after_prop = self.sheet.title + + self.assertEqual(title_after, new_title) + self.assertEqual(title_after_prop, new_title) + self.assertNotEqual(title_before, new_title) + self.assertNotEqual(title_before_prop, new_title) + @pytest.mark.vcr() def test_update_tab_color(self): # Assert that the method returns None. From 55dd86273b06d144db0f93e802ea4ff9c7fbcfa8 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:38:08 +0100 Subject: [PATCH 03/11] fix test_freeze test --- gspread/worksheet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 4c3f393b8..ff7c2534b 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -2115,6 +2115,8 @@ def freeze(self, rows=None, cols=None): ] } + self._properties["gridProperties"]["frozenRowCount"] = rows + self._properties["gridProperties"]["frozenColumnCount"] = cols return self.spreadsheet.batch_update(body) @cast_to_a1_notation @@ -2735,6 +2737,7 @@ def _set_hidden_flag(self, hidden): ] } + self._properties["hidden"] = hidden return self.spreadsheet.batch_update(body) def hide(self): From 36dd7821d9442425751e623d7113b9ae1db8db83 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:41:45 +0100 Subject: [PATCH 04/11] set internal properties *after* API call --- gspread/worksheet.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index ff7c2534b..ab29e1484 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -2115,9 +2115,12 @@ def freeze(self, rows=None, cols=None): ] } - self._properties["gridProperties"]["frozenRowCount"] = rows - self._properties["gridProperties"]["frozenColumnCount"] = cols - return self.spreadsheet.batch_update(body) + res = self.spreadsheet.batch_update(body) + if rows is not None: + self._properties["gridProperties"]["frozenRowCount"] = rows + if cols is not None: + self._properties["gridProperties"]["frozenColumnCount"] = cols + return res @cast_to_a1_notation def set_basic_filter(self, name=None): From 825c926572a61452d98e9118490d2365bd858609 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:41:59 +0100 Subject: [PATCH 05/11] fix test_resize internal property change --- gspread/worksheet.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index ab29e1484..da0e01e1c 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -1318,7 +1318,12 @@ def resize(self, rows=None, cols=None): ] } - return self.spreadsheet.batch_update(body) + res = self.spreadsheet.batch_update(body) + if rows is not None: + self._properties["gridProperties"]["rowCount"] = rows + if cols is not None: + self._properties["gridProperties"]["columnCount"] = cols + return res # TODO(post Python 2): replace the method signature with # def sort(self, *specs, range=None): From 4aff7b04d7b00c1004bd950b34e6317376bb6d7f Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:49:48 +0100 Subject: [PATCH 06/11] update test_worksheet_update_index it wasn't actually testing for anything before since only 1 sheet cannot reorder now we add more sheets also had to add cassette --- ...sheetTest.test_worksheet_update_index.json | 494 ++++++++++++------ tests/worksheet_test.py | 17 +- 2 files changed, 355 insertions(+), 156 deletions(-) diff --git a/tests/cassettes/WorksheetTest.test_worksheet_update_index.json b/tests/cassettes/WorksheetTest.test_worksheet_update_index.json index c5d24aeca..5d438f74e 100644 --- a/tests/cassettes/WorksheetTest.test_worksheet_update_index.json +++ b/tests/cassettes/WorksheetTest.test_worksheet_update_index.json @@ -8,7 +8,7 @@ "body": "{\"name\": \"Test WorksheetTest test_worksheet_update_index\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -19,6 +19,9 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "Content-Length": [ "113" ], @@ -36,63 +39,59 @@ "message": "OK" }, "headers": { - "Vary": [ - "Origin", - "X-Origin" - ], "Cache-Control": [ "no-cache, no-store, max-age=0, must-revalidate" ], + "X-XSS-Protection": [ + "0" + ], "X-Frame-Options": [ "SAMEORIGIN" ], + "Vary": [ + "Origin, X-Origin" + ], "Pragma": [ "no-cache" ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], "X-Content-Type-Options": [ "nosniff" ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], "Server": [ - "GSE" + "ESF" ], "Transfer-Encoding": [ "chunked" ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" - ], "Date": [ - "Sun, 27 Feb 2022 16:55:24 GMT" - ], - "Content-Type": [ - "application/json; charset=UTF-8" - ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "Wed, 07 Jun 2023 22:48:38 GMT" ], - "X-XSS-Protection": [ - "1; mode=block" - ], - "Content-Security-Policy": [ - "frame-ancestors 'self'" + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" ], "content-length": [ - "196" + "200" ] }, "body": { - "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU\",\n \"name\": \"Test WorksheetTest test_worksheet_update_index\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" + "string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"name\": \"Test WorksheetTest test_worksheet_update_index\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" } } }, { "request": { "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU?includeGridData=false", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU?includeGridData=false", "body": null, "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -103,6 +102,9 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "authorization": [ "" ] @@ -114,55 +116,55 @@ "message": "OK" }, "headers": { - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], "Cache-Control": [ "private" ], + "X-XSS-Protection": [ + "0" + ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Transfer-Encoding": [ - "chunked" + "Vary": [ + "Origin", + "X-Origin", + "Referer" ], - "Server": [ - "ESF" + "Content-Type": [ + "application/json; charset=UTF-8" ], "X-Content-Type-Options": [ "nosniff" ], - "Date": [ - "Sun, 27 Feb 2022 16:55:25 GMT" + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "Content-Type": [ - "application/json; charset=UTF-8" + "Server": [ + "ESF" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "Transfer-Encoding": [ + "chunked" ], - "X-XSS-Protection": [ - "0" + "Date": [ + "Wed, 07 Jun 2023 22:48:38 GMT" ], "content-length": [ "3344" ] }, "body": { - "string": "{\n \"spreadsheetId\": \"1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU/edit\"\n}\n" + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU/edit\"\n}\n" } } }, { "request": { "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU?includeGridData=false", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU?includeGridData=false", "body": null, "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -173,6 +175,9 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "authorization": [ "" ] @@ -184,55 +189,55 @@ "message": "OK" }, "headers": { - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], "Cache-Control": [ "private" ], + "X-XSS-Protection": [ + "0" + ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Transfer-Encoding": [ - "chunked" + "Vary": [ + "Origin", + "X-Origin", + "Referer" ], - "Server": [ - "ESF" + "Content-Type": [ + "application/json; charset=UTF-8" ], "X-Content-Type-Options": [ "nosniff" ], - "Date": [ - "Sun, 27 Feb 2022 16:55:25 GMT" + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "Content-Type": [ - "application/json; charset=UTF-8" + "Server": [ + "ESF" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "Transfer-Encoding": [ + "chunked" ], - "X-XSS-Protection": [ - "0" + "Date": [ + "Wed, 07 Jun 2023 22:48:38 GMT" ], "content-length": [ "3344" ] }, "body": { - "string": "{\n \"spreadsheetId\": \"1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU/edit\"\n}\n" + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU/edit\"\n}\n" } } }, { "request": { "method": "POST", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU/values/%27Sheet1%27:clear", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU/values/%27Sheet1%27:clear", "body": null, "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -243,6 +248,9 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "Content-Length": [ "0" ], @@ -257,55 +265,213 @@ "message": "OK" }, "headers": { + "Cache-Control": [ + "private" + ], + "X-XSS-Protection": [ + "0" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], "Vary": [ "Origin", "X-Origin", "Referer" ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Wed, 07 Jun 2023 22:48:38 GMT" + ], + "content-length": [ + "107" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU:batchUpdate", + "body": "{\"requests\": [{\"addSheet\": {\"properties\": {\"title\": \"test_sheet\", \"sheetType\": \"GRID\", \"gridProperties\": {\"rowCount\": 100, \"columnCount\": 100}}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "Content-Length": [ + "147" + ], + "Content-Type": [ + "application/json" + ], + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { "Cache-Control": [ "private" ], + "X-XSS-Protection": [ + "0" + ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Transfer-Encoding": [ - "chunked" + "Vary": [ + "Origin", + "X-Origin", + "Referer" ], - "Server": [ - "ESF" + "Content-Type": [ + "application/json; charset=UTF-8" ], "X-Content-Type-Options": [ "nosniff" ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "Transfer-Encoding": [ + "chunked" + ], "Date": [ - "Sun, 27 Feb 2022 16:55:25 GMT" + "Wed, 07 Jun 2023 22:48:39 GMT" + ], + "content-length": [ + "385" + ] + }, + "body": { + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"replies\": [\n {\n \"addSheet\": {\n \"properties\": {\n \"sheetId\": 1534986799,\n \"title\": \"test_sheet\",\n \"index\": 1,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 100,\n \"columnCount\": 100\n }\n }\n }\n }\n ]\n}\n" + } + } + }, + { + "request": { + "method": "POST", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU:batchUpdate", + "body": "{\"requests\": [{\"addSheet\": {\"properties\": {\"title\": \"test_sheet 2\", \"sheetType\": \"GRID\", \"gridProperties\": {\"rowCount\": 100, \"columnCount\": 100}}}}]}", + "headers": { + "User-Agent": [ + "python-requests/2.31.0" + ], + "Accept-Encoding": [ + "gzip, deflate" + ], + "Accept": [ + "*/*" + ], + "Connection": [ + "keep-alive" + ], + "x-goog-api-client": [ + "cred-type/sa" + ], + "Content-Length": [ + "149" ], "Content-Type": [ - "application/json; charset=UTF-8" + "application/json" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "authorization": [ + "" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "OK" + }, + "headers": { + "Cache-Control": [ + "private" ], "X-XSS-Protection": [ "0" ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Date": [ + "Wed, 07 Jun 2023 22:48:39 GMT" + ], "content-length": [ - "107" + "386" ] }, "body": { - "string": "{\n \"spreadsheetId\": \"1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU\",\n \"clearedRange\": \"Sheet1!A1:Z1000\"\n}\n" + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"replies\": [\n {\n \"addSheet\": {\n \"properties\": {\n \"sheetId\": 184023882,\n \"title\": \"test_sheet 2\",\n \"index\": 2,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 100,\n \"columnCount\": 100\n }\n }\n }\n }\n ]\n}\n" } } }, { "request": { "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU?includeGridData=false", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU?includeGridData=false", "body": null, "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -316,6 +482,9 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "authorization": [ "" ] @@ -327,55 +496,55 @@ "message": "OK" }, "headers": { - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], "Cache-Control": [ "private" ], + "X-XSS-Protection": [ + "0" + ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Transfer-Encoding": [ - "chunked" + "Vary": [ + "Origin", + "X-Origin", + "Referer" ], - "Server": [ - "ESF" + "Content-Type": [ + "application/json; charset=UTF-8" ], "X-Content-Type-Options": [ "nosniff" ], - "Date": [ - "Sun, 27 Feb 2022 16:55:25 GMT" + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "Content-Type": [ - "application/json; charset=UTF-8" + "Server": [ + "ESF" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "Transfer-Encoding": [ + "chunked" ], - "X-XSS-Protection": [ - "0" + "Date": [ + "Wed, 07 Jun 2023 22:48:39 GMT" ], "content-length": [ - "3344" + "3841" ] }, "body": { - "string": "{\n \"spreadsheetId\": \"1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU/edit\"\n}\n" + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n },\n {\n \"properties\": {\n \"sheetId\": 1534986799,\n \"title\": \"test_sheet\",\n \"index\": 1,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 100,\n \"columnCount\": 100\n }\n }\n },\n {\n \"properties\": {\n \"sheetId\": 184023882,\n \"title\": \"test_sheet 2\",\n \"index\": 2,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 100,\n \"columnCount\": 100\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU/edit\"\n}\n" } } }, { "request": { "method": "POST", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU:batchUpdate", - "body": "{\"requests\": [{\"updateSheetProperties\": {\"properties\": {\"sheetId\": 0, \"index\": 0}, \"fields\": \"index\"}}]}", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU:batchUpdate", + "body": "{\"requests\": [{\"updateSheetProperties\": {\"properties\": {\"sheetId\": 184023882, \"index\": 0}, \"fields\": \"index\"}}]}", "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -386,8 +555,11 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "Content-Length": [ - "104" + "112" ], "Content-Type": [ "application/json" @@ -403,55 +575,55 @@ "message": "OK" }, "headers": { - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], "Cache-Control": [ "private" ], + "X-XSS-Protection": [ + "0" + ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Transfer-Encoding": [ - "chunked" + "Vary": [ + "Origin", + "X-Origin", + "Referer" ], - "Server": [ - "ESF" + "Content-Type": [ + "application/json; charset=UTF-8" ], "X-Content-Type-Options": [ "nosniff" ], - "Date": [ - "Sun, 27 Feb 2022 16:55:25 GMT" + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "Content-Type": [ - "application/json; charset=UTF-8" + "Server": [ + "ESF" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "Transfer-Encoding": [ + "chunked" ], - "X-XSS-Protection": [ - "0" + "Date": [ + "Wed, 07 Jun 2023 22:48:39 GMT" ], "content-length": [ "97" ] }, "body": { - "string": "{\n \"spreadsheetId\": \"1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU\",\n \"replies\": [\n {}\n ]\n}\n" + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"replies\": [\n {}\n ]\n}\n" } } }, { "request": { "method": "GET", - "uri": "https://sheets.googleapis.com/v4/spreadsheets/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU?includeGridData=false", + "uri": "https://sheets.googleapis.com/v4/spreadsheets/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU?includeGridData=false", "body": null, "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -462,6 +634,9 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "authorization": [ "" ] @@ -473,55 +648,55 @@ "message": "OK" }, "headers": { - "Vary": [ - "Origin", - "X-Origin", - "Referer" - ], "Cache-Control": [ "private" ], + "X-XSS-Protection": [ + "0" + ], "X-Frame-Options": [ "SAMEORIGIN" ], - "Transfer-Encoding": [ - "chunked" + "Vary": [ + "Origin", + "X-Origin", + "Referer" ], - "Server": [ - "ESF" + "Content-Type": [ + "application/json; charset=UTF-8" ], "X-Content-Type-Options": [ "nosniff" ], - "Date": [ - "Sun, 27 Feb 2022 16:55:26 GMT" + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" ], - "Content-Type": [ - "application/json; charset=UTF-8" + "Server": [ + "ESF" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "Transfer-Encoding": [ + "chunked" ], - "X-XSS-Protection": [ - "0" + "Date": [ + "Wed, 07 Jun 2023 22:48:40 GMT" ], "content-length": [ - "3344" + "3841" ] }, "body": { - "string": "{\n \"spreadsheetId\": \"1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU/edit\"\n}\n" + "string": "{\n \"spreadsheetId\": \"1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU\",\n \"properties\": {\n \"title\": \"Test WorksheetTest test_worksheet_update_index\",\n \"locale\": \"en_US\",\n \"autoRecalc\": \"ON_CHANGE\",\n \"timeZone\": \"Etc/GMT\",\n \"defaultFormat\": {\n \"backgroundColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n },\n \"padding\": {\n \"top\": 2,\n \"right\": 3,\n \"bottom\": 2,\n \"left\": 3\n },\n \"verticalAlignment\": \"BOTTOM\",\n \"wrapStrategy\": \"OVERFLOW_CELL\",\n \"textFormat\": {\n \"foregroundColor\": {},\n \"fontFamily\": \"arial,sans,sans-serif\",\n \"fontSize\": 10,\n \"bold\": false,\n \"italic\": false,\n \"strikethrough\": false,\n \"underline\": false,\n \"foregroundColorStyle\": {\n \"rgbColor\": {}\n }\n },\n \"backgroundColorStyle\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n \"spreadsheetTheme\": {\n \"primaryFontFamily\": \"Arial\",\n \"themeColors\": [\n {\n \"colorType\": \"TEXT\",\n \"color\": {\n \"rgbColor\": {}\n }\n },\n {\n \"colorType\": \"BACKGROUND\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 1,\n \"blue\": 1\n }\n }\n },\n {\n \"colorType\": \"ACCENT1\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.25882354,\n \"green\": 0.52156866,\n \"blue\": 0.95686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT2\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.91764706,\n \"green\": 0.2627451,\n \"blue\": 0.20784314\n }\n }\n },\n {\n \"colorType\": \"ACCENT3\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.9843137,\n \"green\": 0.7372549,\n \"blue\": 0.015686275\n }\n }\n },\n {\n \"colorType\": \"ACCENT4\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.20392157,\n \"green\": 0.65882355,\n \"blue\": 0.3254902\n }\n }\n },\n {\n \"colorType\": \"ACCENT5\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 1,\n \"green\": 0.42745098,\n \"blue\": 0.003921569\n }\n }\n },\n {\n \"colorType\": \"ACCENT6\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.27450982,\n \"green\": 0.7411765,\n \"blue\": 0.7764706\n }\n }\n },\n {\n \"colorType\": \"LINK\",\n \"color\": {\n \"rgbColor\": {\n \"red\": 0.06666667,\n \"green\": 0.33333334,\n \"blue\": 0.8\n }\n }\n }\n ]\n }\n },\n \"sheets\": [\n {\n \"properties\": {\n \"sheetId\": 184023882,\n \"title\": \"test_sheet 2\",\n \"index\": 0,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 100,\n \"columnCount\": 100\n }\n }\n },\n {\n \"properties\": {\n \"sheetId\": 0,\n \"title\": \"Sheet1\",\n \"index\": 1,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 1000,\n \"columnCount\": 26\n }\n }\n },\n {\n \"properties\": {\n \"sheetId\": 1534986799,\n \"title\": \"test_sheet\",\n \"index\": 2,\n \"sheetType\": \"GRID\",\n \"gridProperties\": {\n \"rowCount\": 100,\n \"columnCount\": 100\n }\n }\n }\n ],\n \"spreadsheetUrl\": \"https://docs.google.com/spreadsheets/d/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU/edit\"\n}\n" } } }, { "request": { "method": "DELETE", - "uri": "https://www.googleapis.com/drive/v3/files/1jvS7CzMMPLLHOkTrLcbmgHJ2P31dg3EKMW6k83rsUQU?supportsAllDrives=True", + "uri": "https://www.googleapis.com/drive/v3/files/1yOSqEyRXQz7fNCj6P8eHfVGonErF8RT1IVNRqC17lCU?supportsAllDrives=True", "body": null, "headers": { "User-Agent": [ - "python-requests/2.27.1" + "python-requests/2.31.0" ], "Accept-Encoding": [ "gzip, deflate" @@ -532,6 +707,9 @@ "Connection": [ "keep-alive" ], + "x-goog-api-client": [ + "cred-type/sa" + ], "Content-Length": [ "0" ], @@ -546,27 +724,41 @@ "message": "No Content" }, "headers": { - "Vary": [ - "Origin", - "X-Origin" + "Content-Length": [ + "0" ], "Cache-Control": [ "no-cache, no-store, max-age=0, must-revalidate" ], + "X-XSS-Protection": [ + "0" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "Vary": [ + "Origin, X-Origin" + ], "Pragma": [ "no-cache" ], - "Server": [ - "GSE" + "Content-Type": [ + "text/html" ], - "Expires": [ - "Mon, 01 Jan 1990 00:00:00 GMT" + "X-Content-Type-Options": [ + "nosniff" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" + ], + "Server": [ + "ESF" ], "Date": [ - "Sun, 27 Feb 2022 16:55:26 GMT" + "Wed, 07 Jun 2023 22:48:40 GMT" ], - "Alt-Svc": [ - "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" ] }, "body": { diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index 74f24debc..0f7a033cf 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -979,12 +979,19 @@ def test_reorder_worksheets(self): @pytest.mark.vcr() def test_worksheet_update_index(self): - w = self.spreadsheet.worksheets() - last_sheet = w[-1] + # need to have multiple worksheets to reorder them + self.spreadsheet.add_worksheet("test_sheet", 100, 100) + self.spreadsheet.add_worksheet("test_sheet 2", 100, 100) + + worksheets = self.spreadsheet.worksheets() + last_sheet = worksheets[-1] + self.assertEqual(last_sheet.index, len(worksheets) - 1) + last_sheet.update_index(0) - w = self.spreadsheet.worksheets() - self.assertEqual(w[0].id, last_sheet.id) - self.assertEuql(last_sheet.index, 0) + + worksheets = self.spreadsheet.worksheets() + self.assertEqual(worksheets[0].id, last_sheet.id) + self.assertEqual(last_sheet.index, 0) @pytest.mark.vcr() def test_worksheet_notes(self): From 9c226e3618a645133f81f7175f7688ae62e80111 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:50:02 +0100 Subject: [PATCH 07/11] fix test_worksheet_update_index by updating internal state --- gspread/worksheet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index da0e01e1c..9c0a00f83 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -1477,7 +1477,9 @@ def update_index(self, index): ] } - return self.spreadsheet.batch_update(body) + res = self.spreadsheet.batch_update(body) + self._properties["index"] = index + return res def _auto_resize(self, start_index, end_index, dimension): """Updates the size of rows or columns in the worksheet. From 9897d406829410daf53094ff5849ac511cb494bd Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:55:57 +0100 Subject: [PATCH 08/11] get prop in test --- tests/worksheet_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index 0f7a033cf..4889fefcb 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -1134,6 +1134,7 @@ def test_hide_show_worksheet(self): res = self.spreadsheet.fetch_sheet_metadata() before_hide = res["sheets"][1]["properties"].get("hidden", False) + before_hide_prop = self.sheet.isSheetHidden self.assertFalse(before_hide) self.assertFalse(before_hide_prop) From b679a5431d6a5bed8842fbedd56f3ce150e69df2 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:56:08 +0100 Subject: [PATCH 09/11] move API call before internal prop change --- gspread/worksheet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gspread/worksheet.py b/gspread/worksheet.py index 9c0a00f83..c0a502831 100644 --- a/gspread/worksheet.py +++ b/gspread/worksheet.py @@ -2747,8 +2747,9 @@ def _set_hidden_flag(self, hidden): ] } + res = self.spreadsheet.batch_update(body) self._properties["hidden"] = hidden - return self.spreadsheet.batch_update(body) + return res def hide(self): """Hides the current worksheet from the UI.""" From cf93246b6a8e872118ed8b4f76ae2231cc511cd4 Mon Sep 17 00:00:00 2001 From: alifeee Date: Wed, 7 Jun 2023 23:57:28 +0100 Subject: [PATCH 10/11] change variables names to be more obviuous --- tests/worksheet_test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index 4889fefcb..114861e67 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -1116,27 +1116,27 @@ def test_hide_show_worksheet(self): # the response does not include some default values. # if missing => value is False res = self.spreadsheet.fetch_sheet_metadata() - before_hide = res["sheets"][1]["properties"].get("hidden", False) - before_hide_prop = self.sheet.isSheetHidden + hidden_before = res["sheets"][1]["properties"].get("hidden", False) + hidden_before_prop = self.sheet.isSheetHidden - self.assertFalse(before_hide) - self.assertFalse(before_hide_prop) + self.assertFalse(hidden_before) + self.assertFalse(hidden_before_prop) new_sheet.hide() res = self.spreadsheet.fetch_sheet_metadata() - after_hide = res["sheets"][1]["properties"].get("hidden", False) - after_hide_prop = self.sheet.isSheetHidden - self.assertTrue(after_hide) - self.assertTrue(after_hide_prop) + hidden_after = res["sheets"][1]["properties"].get("hidden", False) + hidden_after_prop = self.sheet.isSheetHidden + self.assertTrue(hidden_after) + self.assertTrue(hidden_after_prop) new_sheet.show() res = self.spreadsheet.fetch_sheet_metadata() - before_hide = res["sheets"][1]["properties"].get("hidden", False) - before_hide_prop = self.sheet.isSheetHidden - self.assertFalse(before_hide) - self.assertFalse(before_hide_prop) + hidden_before = res["sheets"][1]["properties"].get("hidden", False) + hidden_before_prop = self.sheet.isSheetHidden + self.assertFalse(hidden_before) + self.assertFalse(hidden_before_prop) @pytest.mark.vcr() def test_hide_gridlines(self): From 34dd2013fa813a7d123423a2018dd2dd3717e850 Mon Sep 17 00:00:00 2001 From: alifeee Date: Thu, 8 Jun 2023 00:10:28 +0100 Subject: [PATCH 11/11] test *new* sheet for hidden property not old sheet --- tests/worksheet_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/worksheet_test.py b/tests/worksheet_test.py index 114861e67..a4183dc32 100644 --- a/tests/worksheet_test.py +++ b/tests/worksheet_test.py @@ -1117,7 +1117,7 @@ def test_hide_show_worksheet(self): # if missing => value is False res = self.spreadsheet.fetch_sheet_metadata() hidden_before = res["sheets"][1]["properties"].get("hidden", False) - hidden_before_prop = self.sheet.isSheetHidden + hidden_before_prop = new_sheet.isSheetHidden self.assertFalse(hidden_before) self.assertFalse(hidden_before_prop) @@ -1126,7 +1126,7 @@ def test_hide_show_worksheet(self): res = self.spreadsheet.fetch_sheet_metadata() hidden_after = res["sheets"][1]["properties"].get("hidden", False) - hidden_after_prop = self.sheet.isSheetHidden + hidden_after_prop = new_sheet.isSheetHidden self.assertTrue(hidden_after) self.assertTrue(hidden_after_prop) @@ -1134,7 +1134,7 @@ def test_hide_show_worksheet(self): res = self.spreadsheet.fetch_sheet_metadata() hidden_before = res["sheets"][1]["properties"].get("hidden", False) - hidden_before_prop = self.sheet.isSheetHidden + hidden_before_prop = new_sheet.isSheetHidden self.assertFalse(hidden_before) self.assertFalse(hidden_before_prop)