Beispiel #1
0
    def test__unit__CommentOwnerChecker__ok__nominal_case(self):
        class FakeTracimContext(TracimContext):
            current_user = User(user_id=2, email='*****@*****.**')
            current_comment = Content(content_id=15,
                                      type=content_type_list.Comment.slug,
                                      owner=current_user)

        assert CommentOwnerChecker().check(FakeTracimContext())
Beispiel #2
0
    def test__unit__CommentOwnerChecker__err_user_not_owner_case(self):
        class FakeTracimContext(TracimContext):
            current_user = User(user_id=2, email='*****@*****.**')
            current_comment = Content(content_id=15,
                                      type=content_type_list.Comment.slug,
                                      owner=User(user_id=3,
                                                 email='*****@*****.**'))

        with pytest.raises(UserIsNotContentOwner):
            CommentOwnerChecker().check(FakeTracimContext())