def test_returns_true_for_uploaded(self): """ If the user uploaded the image it should return true. """ image = ImageFactory.create() adaptor_field = MagicMock() adaptor_field.obj = image adaptor_field.request.user = image.uploaded_by self.assertTrue(UploadedByEditInline.can_edit(adaptor_field))
def test_returns_false_for_anonymous_users(self): image = ImageFactory.create() adaptor_field = MagicMock() adaptor_field.obj = image adaptor_field.request.user = AnonymousUser() self.assertFalse(UploadedByEditInline.can_edit(adaptor_field))