def test_get_sheets_in_spreadsheet(self): spreadsheet_id = "id1" expected_sheets = ["s1", "s2"] client = Mock() client.get.return_value.execute.return_value = Spreadsheet( spreadsheetId=spreadsheet_id, sheets=[Sheet(properties=SheetProperties(title=t)) for t in expected_sheets] ) with patch.object(GoogleSheetsClient, "__init__", lambda s, credentials, scopes: None): sheet_client = GoogleSheetsClient({"fake": "credentials"}, ["auth_scopes"]) sheet_client.client = client actual_sheets = Helpers.get_sheets_in_spreadsheet(sheet_client, spreadsheet_id) self.assertEqual(expected_sheets, actual_sheets) client.get.assert_called_with(spreadsheetId=spreadsheet_id, includeGridData=False)
def test_get_sheets_in_spreadsheet(self): spreadsheet_id = "id1" expected_sheets = ["s1", "s2"] client = Mock() client.get.return_value.execute.return_value = Spreadsheet( spreadsheetId=spreadsheet_id, sheets=[ Sheet(properties=SheetProperties(title=t)) for t in expected_sheets ]) actual_sheets = Helpers.get_sheets_in_spreadsheet( client, spreadsheet_id) self.assertEqual(expected_sheets, actual_sheets) client.get.assert_called_with(spreadsheetId=spreadsheet_id, includeGridData=False)