def test_delete_with_sheet_success(self, mock): """Ensure that DELETE works properlly """ mock.return_value = MagicMock(status_code=204) client = SheetsuClient(**self.kwargs) response = client.delete(sheet="Sheet1", column="name", value="Meg") self.assertIsNone(response)
def test_delete_clear_with_bad_response_fail(self, mock): """Ensure that DELETE in clear-mode raises an exception when it doesn't get a 204""" mock.return_value = MagicMock(status_code=205) client = SheetsuClient(**self.kwargs) with self.assertRaises(UnexpectedResponseCode): response = client.delete(sheet="Sheet1", column="name", value="Meg")
def test_delete_with_sheet_success(self, mock): """Ensure that DELETE works properlly """ mock.return_value = MagicMock(status_code=200, content=json.dumps([{ 'id': '5', 'name': 'Stewie', 'score': '72' }])) client = SheetsuClient(**self.kwargs) response = client.delete(sheet="Sheet1", column="name", value="Meg") self.assertEqual(response, [{ 'id': '5', 'name': 'Stewie', 'score': '72' }])