-
Notifications
You must be signed in to change notification settings - Fork 948
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 #1512 from burnash/test/handle_api_error_not_json
Add test on receiving an invalid JSON in the APIError exception handler.
- Loading branch information
Showing
3 changed files
with
278 additions
and
2 deletions.
There are no files selected for viewing
232 changes: 232 additions & 0 deletions
232
tests/cassettes/SpreadsheetTest.test_bad_json_api_error.json
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,232 @@ | ||
{ | ||
"version": 1, | ||
"interactions": [ | ||
{ | ||
"request": { | ||
"method": "POST", | ||
"uri": "https://www.googleapis.com/drive/v3/files?supportsAllDrives=True", | ||
"body": "{\"name\": \"Test SpreadsheetTest test_bad_json_api_error\", \"mimeType\": \"application/vnd.google-apps.spreadsheet\"}", | ||
"headers": { | ||
"User-Agent": [ | ||
"python-requests/2.32.3" | ||
], | ||
"Accept-Encoding": [ | ||
"gzip, deflate" | ||
], | ||
"Accept": [ | ||
"*/*" | ||
], | ||
"Connection": [ | ||
"keep-alive" | ||
], | ||
"Content-Length": [ | ||
"111" | ||
], | ||
"Content-Type": [ | ||
"application/json" | ||
], | ||
"authorization": [ | ||
"<ACCESS_TOKEN>" | ||
] | ||
} | ||
}, | ||
"response": { | ||
"status": { | ||
"code": 200, | ||
"message": "OK" | ||
}, | ||
"headers": { | ||
"Expires": [ | ||
"Mon, 01 Jan 1990 00:00:00 GMT" | ||
], | ||
"Content-Type": [ | ||
"application/json; charset=UTF-8" | ||
], | ||
"Date": [ | ||
"Sun, 22 Sep 2024 21:14:56 GMT" | ||
], | ||
"Alt-Svc": [ | ||
"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" | ||
], | ||
"Transfer-Encoding": [ | ||
"chunked" | ||
], | ||
"Vary": [ | ||
"Origin, X-Origin" | ||
], | ||
"X-XSS-Protection": [ | ||
"0" | ||
], | ||
"X-Frame-Options": [ | ||
"SAMEORIGIN" | ||
], | ||
"Server": [ | ||
"ESF" | ||
], | ||
"Cache-Control": [ | ||
"no-cache, no-store, max-age=0, must-revalidate" | ||
], | ||
"X-Content-Type-Options": [ | ||
"nosniff" | ||
], | ||
"Pragma": [ | ||
"no-cache" | ||
], | ||
"content-length": [ | ||
"198" | ||
] | ||
}, | ||
"body": { | ||
"string": "{\n \"kind\": \"drive#file\",\n \"id\": \"1YCFTdhfXm6o_JeYoFgYquVItZBeeAju8sF7Xuz1Tr-Y\",\n \"name\": \"Test SpreadsheetTest test_bad_json_api_error\",\n \"mimeType\": \"application/vnd.google-apps.spreadsheet\"\n}\n" | ||
} | ||
} | ||
}, | ||
{ | ||
"request": { | ||
"method": "GET", | ||
"uri": "https://sheets.googleapis.com/v4/spreadsheets/1YCFTdhfXm6o_JeYoFgYquVItZBeeAju8sF7Xuz1Tr-Y?includeGridData=false", | ||
"body": null, | ||
"headers": { | ||
"User-Agent": [ | ||
"python-requests/2.32.3" | ||
], | ||
"Accept-Encoding": [ | ||
"gzip, deflate" | ||
], | ||
"Accept": [ | ||
"*/*" | ||
], | ||
"Connection": [ | ||
"keep-alive" | ||
], | ||
"authorization": [ | ||
"<ACCESS_TOKEN>" | ||
] | ||
} | ||
}, | ||
"response": { | ||
"status": { | ||
"code": 200, | ||
"message": "OK" | ||
}, | ||
"headers": { | ||
"Content-Type": [ | ||
"application/json; charset=UTF-8" | ||
], | ||
"x-l2-request-path": [ | ||
"l2-managed-6" | ||
], | ||
"Alt-Svc": [ | ||
"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" | ||
], | ||
"Transfer-Encoding": [ | ||
"chunked" | ||
], | ||
"Vary": [ | ||
"Origin", | ||
"X-Origin", | ||
"Referer" | ||
], | ||
"X-XSS-Protection": [ | ||
"0" | ||
], | ||
"X-Frame-Options": [ | ||
"SAMEORIGIN" | ||
], | ||
"Server": [ | ||
"ESF" | ||
], | ||
"Cache-Control": [ | ||
"private" | ||
], | ||
"X-Content-Type-Options": [ | ||
"nosniff" | ||
], | ||
"Date": [ | ||
"Sun, 22 Sep 2024 21:14:57 GMT" | ||
], | ||
"content-length": [ | ||
"3342" | ||
] | ||
}, | ||
"body": { | ||
"string": "{\n \"spreadsheetId\": \"1YCFTdhfXm6o_JeYoFgYquVItZBeeAju8sF7Xuz1Tr-Y\",\n \"properties\": {\n \"title\": \"Test SpreadsheetTest test_bad_json_api_error\",\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/1YCFTdhfXm6o_JeYoFgYquVItZBeeAju8sF7Xuz1Tr-Y/edit\"\n}\n" | ||
} | ||
} | ||
}, | ||
{ | ||
"request": { | ||
"method": "DELETE", | ||
"uri": "https://www.googleapis.com/drive/v3/files/1YCFTdhfXm6o_JeYoFgYquVItZBeeAju8sF7Xuz1Tr-Y?supportsAllDrives=True", | ||
"body": null, | ||
"headers": { | ||
"User-Agent": [ | ||
"python-requests/2.32.3" | ||
], | ||
"Accept-Encoding": [ | ||
"gzip, deflate" | ||
], | ||
"Accept": [ | ||
"*/*" | ||
], | ||
"Connection": [ | ||
"keep-alive" | ||
], | ||
"Content-Length": [ | ||
"0" | ||
], | ||
"authorization": [ | ||
"<ACCESS_TOKEN>" | ||
] | ||
} | ||
}, | ||
"response": { | ||
"status": { | ||
"code": 204, | ||
"message": "No Content" | ||
}, | ||
"headers": { | ||
"Expires": [ | ||
"Mon, 01 Jan 1990 00:00:00 GMT" | ||
], | ||
"Content-Type": [ | ||
"text/html" | ||
], | ||
"Alt-Svc": [ | ||
"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000" | ||
], | ||
"Content-Length": [ | ||
"0" | ||
], | ||
"Vary": [ | ||
"Origin, X-Origin" | ||
], | ||
"X-XSS-Protection": [ | ||
"0" | ||
], | ||
"X-Frame-Options": [ | ||
"SAMEORIGIN" | ||
], | ||
"Server": [ | ||
"ESF" | ||
], | ||
"Cache-Control": [ | ||
"no-cache, no-store, max-age=0, must-revalidate" | ||
], | ||
"X-Content-Type-Options": [ | ||
"nosniff" | ||
], | ||
"Pragma": [ | ||
"no-cache" | ||
], | ||
"Date": [ | ||
"Sun, 22 Sep 2024 21:14:57 GMT" | ||
] | ||
}, | ||
"body": { | ||
"string": "" | ||
} | ||
} | ||
} | ||
] | ||
} |
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