Add testcases for updating with empty attributes
This commit is contained in:
parent
8a4a806f8d
commit
5ccc03a835
3 changed files with 26 additions and 0 deletions
|
@ -141,3 +141,11 @@ class TestActionView(TestActions):
|
||||||
self.assertEqual(action.target.id, "photo2")
|
self.assertEqual(action.target.id, "photo2")
|
||||||
self.assertEqual(action.target_type, "photo")
|
self.assertEqual(action.target_type, "photo")
|
||||||
|
|
||||||
|
class TestActionMisc(TestActions):
|
||||||
|
def test_update_fields_with_no_target(self):
|
||||||
|
"""Check that an action object can be updated with no target"""
|
||||||
|
action = self.test_actions[0]
|
||||||
|
action.target = None
|
||||||
|
action.target_type = None
|
||||||
|
# Check that no exception is raised
|
||||||
|
action._update_fields_with_objects()
|
||||||
|
|
|
@ -131,3 +131,12 @@ class TestActivityView(TestActivities):
|
||||||
{"data": "", "type": "invalid"}))
|
{"data": "", "type": "invalid"}))
|
||||||
with self.assertRaises(NotImplementedError):
|
with self.assertRaises(NotImplementedError):
|
||||||
self.client.activity.view(self.test_activities[0])
|
self.client.activity.view(self.test_activities[0])
|
||||||
|
|
||||||
|
class TestActivityMisc(TestActivities):
|
||||||
|
def test_update_fields_with_no_type(self):
|
||||||
|
"""Check that an activity object can be updated with no type"""
|
||||||
|
activity = self.test_activities[0]
|
||||||
|
activity.type = None
|
||||||
|
activity.data = None
|
||||||
|
# Check that no exception is raised
|
||||||
|
activity._update_fields_with_objects()
|
||||||
|
|
|
@ -355,3 +355,12 @@ class TestAlbumView(TestAlbums):
|
||||||
self.assertEqual(album.cover.id, "2b")
|
self.assertEqual(album.cover.id, "2b")
|
||||||
self.assertEqual(album.cover.tags, ["tag3", "tag4"])
|
self.assertEqual(album.cover.tags, ["tag3", "tag4"])
|
||||||
self.assertEqual(album.photos[0].id, self.test_photos[1].id)
|
self.assertEqual(album.photos[0].id, self.test_photos[1].id)
|
||||||
|
|
||||||
|
class TestAlbumMisc(TestAlbums):
|
||||||
|
def test_update_fields_with_no_cover(self):
|
||||||
|
"""Check that an album object can be updated with no cover"""
|
||||||
|
album = self.test_albums[0]
|
||||||
|
album.cover = None
|
||||||
|
album.photos = None
|
||||||
|
# Check that no exception is raised
|
||||||
|
album._update_fields_with_objects()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue