Remove all endpoints that return forms.

This commit is contained in:
sneakypete81 2013-09-07 11:30:27 +01:00
parent adecf7aad0
commit a4add97f59
8 changed files with 0 additions and 90 deletions

View file

@ -63,11 +63,6 @@ class TestAlbums(test_base.TestBase):
for photo in self.photos: for photo in self.photos:
self.assertIn(photo.id, [p.id for p in album.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): def test_add_photos(self):
""" If album.add_photos gets implemented, write a test! """ """ If album.add_photos gets implemented, write a test! """
with self.assertRaises(NotImplementedError): with self.assertRaises(NotImplementedError):

View file

@ -47,16 +47,6 @@ class TestPhotos(test_base.TestBase):
self._delete_all() self._delete_all()
self._create_test_photos() 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("<form", html.lower())
# And the Photo object directly
html = self.photos[0].edit()
self.assertIn("<form", html.lower())
def test_upload_duplicate(self): def test_upload_duplicate(self):
""" Ensure that duplicate photos are rejected """ """ Ensure that duplicate photos are rejected """
# Attempt to upload a duplicate # Attempt to upload a duplicate

View file

@ -130,25 +130,6 @@ class TestAlbumDelete(TestAlbums):
with self.assertRaises(trovebox.TroveboxError): with self.assertRaises(trovebox.TroveboxError):
self.test_albums[0].delete() self.test_albums[0].delete()
class TestAlbumForm(TestAlbums):
@mock.patch.object(trovebox.Trovebox, 'post')
def test_album_form(self, _):
""" If album.form gets implemented, write a test! """
with self.assertRaises(NotImplementedError):
self.client.album.form(self.test_albums[0])
@mock.patch.object(trovebox.Trovebox, 'post')
def test_album_form_id(self, _):
""" If album.form gets implemented, write a test! """
with self.assertRaises(NotImplementedError):
self.client.album.form("1")
@mock.patch.object(trovebox.Trovebox, 'post')
def test_album_object_form(self, _):
""" If album.form gets implemented, write a test! """
with self.assertRaises(NotImplementedError):
self.test_albums[0].form()
class TestAlbumAddPhotos(TestAlbums): class TestAlbumAddPhotos(TestAlbums):
@mock.patch.object(trovebox.Trovebox, 'post') @mock.patch.object(trovebox.Trovebox, 'post')
def test_album_add_photos(self, _): def test_album_add_photos(self, _):

View file

@ -159,34 +159,6 @@ class TestPhotoDelete(TestPhotos):
with self.assertRaises(trovebox.TroveboxError): with self.assertRaises(trovebox.TroveboxError):
self.test_photos[0].delete() self.test_photos[0].delete()
class TestPhotoEdit(TestPhotos):
@mock.patch.object(trovebox.Trovebox, 'get')
def test_photo_edit(self, mock_get):
"""Check that a the photo edit endpoint is working"""
mock_get.return_value = self._return_value({"markup": "<form/>"})
result = self.client.photo.edit(self.test_photos[0])
mock_get.assert_called_with("/photo/1a/edit.json")
self.assertEqual(result, "<form/>")
@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": "<form/>"})
result = self.client.photo.edit("1a")
mock_get.assert_called_with("/photo/1a/edit.json")
self.assertEqual(result, "<form/>")
@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": "<form/>"})
result = self.test_photos[0].edit()
mock_get.assert_called_with("/photo/1a/edit.json")
self.assertEqual(result, "<form/>")
class TestPhotoReplace(TestPhotos): class TestPhotoReplace(TestPhotos):
@mock.patch.object(trovebox.Trovebox, 'post') @mock.patch.object(trovebox.Trovebox, 'post')
def test_photo_replace(self, _): def test_photo_replace(self, _):

View file

@ -43,10 +43,6 @@ class ApiAlbum(ApiBase):
album = Album(self._client, {"id": album}) album = Album(self._client, {"id": album})
return album.delete(**kwds) return album.delete(**kwds)
def form(self, album, **kwds):
""" Not yet implemented """
raise NotImplementedError()
# TODO: Should be just "add" # TODO: Should be just "add"
def add_photos(self, album, photos, **kwds): def add_photos(self, album, photos, **kwds):
""" Not yet implemented """ """ Not yet implemented """

View file

@ -80,16 +80,6 @@ class ApiPhoto(ApiBase):
# def delete_source(self, photo, **kwds): # def delete_source(self, photo, **kwds):
def edit(self, photo, **kwds):
"""
Endpoint: /photo/<id>/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): def replace(self, photo, photo_file, **kwds):
""" Not yet implemented """ """ Not yet implemented """
raise NotImplementedError() raise NotImplementedError()

View file

@ -35,10 +35,6 @@ class Album(TroveboxObject):
self._delete_fields() self._delete_fields()
return result return result
def form(self, **kwds):
""" Not implemented yet """
raise NotImplementedError()
# TODO: Should be just "add" # TODO: Should be just "add"
def add_photos(self, photos, **kwds): def add_photos(self, photos, **kwds):
""" Not implemented yet """ """ Not implemented yet """

View file

@ -23,16 +23,6 @@ class Photo(TroveboxObject):
# def delete_source(self, **kwds): # def delete_source(self, **kwds):
def edit(self, **kwds):
"""
Endpoint: /photo/<id>/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): def replace(self, photo_file, **kwds):
""" Not implemented yet """ """ Not implemented yet """
raise NotImplementedError() raise NotImplementedError()