Remove all endpoints that return forms.
This commit is contained in:
parent
adecf7aad0
commit
a4add97f59
8 changed files with 0 additions and 90 deletions
|
@ -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):
|
||||
|
|
|
@ -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("<form", html.lower())
|
||||
|
||||
# And the Photo object directly
|
||||
html = self.photos[0].edit()
|
||||
self.assertIn("<form", html.lower())
|
||||
|
||||
def test_upload_duplicate(self):
|
||||
""" Ensure that duplicate photos are rejected """
|
||||
# Attempt to upload a duplicate
|
||||
|
|
|
@ -130,25 +130,6 @@ class TestAlbumDelete(TestAlbums):
|
|||
with self.assertRaises(trovebox.TroveboxError):
|
||||
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):
|
||||
@mock.patch.object(trovebox.Trovebox, 'post')
|
||||
def test_album_add_photos(self, _):
|
||||
|
|
|
@ -159,34 +159,6 @@ class TestPhotoDelete(TestPhotos):
|
|||
with self.assertRaises(trovebox.TroveboxError):
|
||||
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):
|
||||
@mock.patch.object(trovebox.Trovebox, 'post')
|
||||
def test_photo_replace(self, _):
|
||||
|
|
|
@ -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 """
|
||||
|
|
|
@ -80,16 +80,6 @@ class ApiPhoto(ApiBase):
|
|||
|
||||
# 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):
|
||||
""" Not yet implemented """
|
||||
raise NotImplementedError()
|
||||
|
|
|
@ -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 """
|
||||
|
|
|
@ -23,16 +23,6 @@ class Photo(TroveboxObject):
|
|||
|
||||
# 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):
|
||||
""" Not implemented yet """
|
||||
raise NotImplementedError()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue