From a4add97f5924bcd0aaaeef5b3b705885c68f2cae Mon Sep 17 00:00:00 2001 From: sneakypete81 Date: Sat, 7 Sep 2013 11:30:27 +0100 Subject: [PATCH] Remove all endpoints that return forms. --- tests/functional/test_albums.py | 5 ----- tests/functional/test_photos.py | 10 ---------- tests/unit/test_albums.py | 19 ------------------- tests/unit/test_photos.py | 28 ---------------------------- trovebox/api/api_album.py | 4 ---- trovebox/api/api_photo.py | 10 ---------- trovebox/objects/album.py | 4 ---- trovebox/objects/photo.py | 10 ---------- 8 files changed, 90 deletions(-) diff --git a/tests/functional/test_albums.py b/tests/functional/test_albums.py index 2b1b21f..276225a 100644 --- a/tests/functional/test_albums.py +++ b/tests/functional/test_albums.py @@ -63,11 +63,6 @@ class TestAlbums(test_base.TestBase): for photo in self.photos: self.assertIn(photo.id, [p.id for p in album.photos]) - def test_form(self): - """ If album.form gets implemented, write a test! """ - with self.assertRaises(NotImplementedError): - self.client.album.form(None) - def test_add_photos(self): """ If album.add_photos gets implemented, write a test! """ with self.assertRaises(NotImplementedError): diff --git a/tests/functional/test_photos.py b/tests/functional/test_photos.py index 6a7577e..19f4bb5 100644 --- a/tests/functional/test_photos.py +++ b/tests/functional/test_photos.py @@ -47,16 +47,6 @@ class TestPhotos(test_base.TestBase): self._delete_all() self._create_test_photos() - def test_edit(self): - """ Check that the edit request returns an HTML form """ - # Test using the Trovebox class - html = self.client.photo.edit(self.photos[0]) - self.assertIn(""}) - result = self.client.photo.edit(self.test_photos[0]) - mock_get.assert_called_with("/photo/1a/edit.json") - self.assertEqual(result, "
") - - @mock.patch.object(trovebox.Trovebox, 'get') - def test_photo_edit_id(self, mock_get): - """Check that a the photo edit endpoint is working when using an ID""" - mock_get.return_value = self._return_value({"markup": ""}) - result = self.client.photo.edit("1a") - mock_get.assert_called_with("/photo/1a/edit.json") - self.assertEqual(result, "") - - @mock.patch.object(trovebox.Trovebox, 'get') - def test_photo_object_edit(self, mock_get): - """ - Check that a the photo edit endpoint is working - when using the photo object directly - """ - mock_get.return_value = self._return_value({"markup": ""}) - result = self.test_photos[0].edit() - mock_get.assert_called_with("/photo/1a/edit.json") - self.assertEqual(result, "") - class TestPhotoReplace(TestPhotos): @mock.patch.object(trovebox.Trovebox, 'post') def test_photo_replace(self, _): diff --git a/trovebox/api/api_album.py b/trovebox/api/api_album.py index eaa147b..fca8cc7 100644 --- a/trovebox/api/api_album.py +++ b/trovebox/api/api_album.py @@ -43,10 +43,6 @@ class ApiAlbum(ApiBase): album = Album(self._client, {"id": album}) return album.delete(**kwds) - def form(self, album, **kwds): - """ Not yet implemented """ - raise NotImplementedError() - # TODO: Should be just "add" def add_photos(self, album, photos, **kwds): """ Not yet implemented """ diff --git a/trovebox/api/api_photo.py b/trovebox/api/api_photo.py index 885ac61..eca7f0c 100644 --- a/trovebox/api/api_photo.py +++ b/trovebox/api/api_photo.py @@ -80,16 +80,6 @@ class ApiPhoto(ApiBase): # def delete_source(self, photo, **kwds): - def edit(self, photo, **kwds): - """ - Endpoint: /photo//edit.json - - Returns an HTML form to edit a photo's attributes. - """ - if not isinstance(photo, Photo): - photo = Photo(self._client, {"id": photo}) - return photo.edit(**kwds) - def replace(self, photo, photo_file, **kwds): """ Not yet implemented """ raise NotImplementedError() diff --git a/trovebox/objects/album.py b/trovebox/objects/album.py index b09b471..6813797 100644 --- a/trovebox/objects/album.py +++ b/trovebox/objects/album.py @@ -35,10 +35,6 @@ class Album(TroveboxObject): self._delete_fields() return result - def form(self, **kwds): - """ Not implemented yet """ - raise NotImplementedError() - # TODO: Should be just "add" def add_photos(self, photos, **kwds): """ Not implemented yet """ diff --git a/trovebox/objects/photo.py b/trovebox/objects/photo.py index 47a9901..03e7435 100644 --- a/trovebox/objects/photo.py +++ b/trovebox/objects/photo.py @@ -23,16 +23,6 @@ class Photo(TroveboxObject): # def delete_source(self, **kwds): - def edit(self, **kwds): - """ - Endpoint: /photo//edit.json - - Returns an HTML form to edit this photo's attributes. - """ - result = self._trovebox.get("/photo/%s/edit.json" % - self.id, **kwds)["result"] - return result["markup"] - def replace(self, photo_file, **kwds): """ Not implemented yet """ raise NotImplementedError()