Пример #1
0
 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))
Пример #2
0
 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))