Пример #1
0
    def test_proposal_view_as_reviewer(self, app, db_session):
        prop = ProposalFactory()
        role = RoleFactory(name = 'reviewer')
        pers = PersonFactory(roles = [role])
        strm = StreamFactory() # need a stream
        ProposalStatusFactory(name='Withdrawn') # Required by code
        db_session.commit()

        do_login(app, pers)

        # reviewers can review a proposal
        resp = app.get(url_for(controller='proposal', action='view', id=prop.id))
        resp = resp.click('Review this proposal', index=0)

        # get the form and start reviewing!
        f = resp.form
        f['review.score'] = 1
        f['review.stream'] = strm.id
        f['review.comment'] = "snuh"
        f.submit()

        db_session.expunge_all()

        # test that we have a review
        reviews = Review.find_all()
        assert len(reviews) == 1
        assert reviews[0].comment == "snuh"
Пример #2
0
    def test_proposal_view_as_reviewer(self, app, db_session):
        prop = ProposalFactory()
        role = RoleFactory(name='reviewer')
        pers = PersonFactory(roles=[role])
        strm = StreamFactory()  # need a stream
        ProposalStatusFactory(name='Withdrawn')  # Required by code
        db_session.commit()

        do_login(app, pers)

        # reviewers can review a proposal
        resp = app.get(
            url_for(controller='proposal', action='view', id=prop.id))
        resp = resp.click('Review this proposal', index=0)

        # get the form and start reviewing!
        f = resp.form
        f['review.score'] = 1
        f['review.stream'] = strm.id
        f['review.comment'] = "snuh"
        f.submit()

        db_session.expunge_all()

        # test that we have a review
        reviews = Review.find_all()
        assert len(reviews) == 1
        assert reviews[0].comment == "snuh"
Пример #3
0
    def test_only_one_review_per_reviewer_per_proposal(self, app, db_session):
        """test that reviewers can only do one review per proposal"""

        p1 = PersonFactory(roles=[RoleFactory(name='reviewer')])
        p2 = PersonFactory()
        prop = ProposalFactory(people=[p2])
        ProposalStatusFactory(name='Withdrawn') # Required by code
        db_session.commit()

        do_login(app, p1)
        resp = app.get('/proposal/%d/review' % prop.id)
        f = resp.form
        f['review.comment'] = 'first_review_comment'
        resp = f.submit()

        # do it again 
        f['review.comment'] = 'second_review_comment'
        resp = f.submit()
        resp = resp.follow() # Failure linked to errors in form submission

        # Old behaviour alerted that review had been performed
        # New behaviour is that we simply update with the second result

        db_session.expunge_all()

        revs = Review.find_all()
        assert len(revs) == 1
        assert revs[0].comment == "second_review_comment"
Пример #4
0
    def test_only_one_review_per_reviewer_per_proposal(self, app, db_session):
        """test that reviewers can only do one review per proposal"""

        p1 = PersonFactory(roles=[RoleFactory(name='reviewer')])
        p2 = PersonFactory()
        prop = ProposalFactory(people=[p2])
        ProposalStatusFactory(name='Withdrawn')  # Required by code
        db_session.commit()

        do_login(app, p1)
        resp = app.get('/proposal/%d/review' % prop.id)
        f = resp.form
        f['review.comment'] = 'first_review_comment'
        resp = f.submit()

        # do it again
        f['review.comment'] = 'second_review_comment'
        resp = f.submit()
        resp = resp.follow()  # Failure linked to errors in form submission

        # Old behaviour alerted that review had been performed
        # New behaviour is that we simply update with the second result

        db_session.expunge_all()

        revs = Review.find_all()
        assert len(revs) == 1
        assert revs[0].comment == "second_review_comment"
Пример #5
0
    def test_create(self, app, db_session):

        StreamFactory(name='streamy')
        prop1 = ProposalFactory()
        prop2 = ProposalFactory()
        p = PersonFactory(roles=[RoleFactory(name='reviewer')])

        ProposalStatusFactory(name='Withdrawn') # Required by code


        db_session.commit()

        do_login(app, p)

        resp = app.get('/proposal/%d/review' % prop1.id)
        resp = resp.maybe_follow()
        f = resp.form
        f['review.score'] = -1
        f['review.comment'] = 'a'
        resp = f.submit()
        resp = resp.follow() # Failure indicates form validation error

        resp = app.get('/proposal/%d/review' % prop2.id)
        resp = resp.maybe_follow()
        f = resp.form
        f['review.score'] = 2
        f['review.comment'] = 'b'
        resp = f.submit()
        resp = resp.follow() # Failure indicates form validation error

        db_session.expunge_all()

        revs = Review.find_all()
        assert len(revs) == 2
        assert revs[0].score == -1
        assert revs[0].comment == 'a'
        assert revs[1].score == 2
        assert revs[1].comment == 'b'
Пример #6
0
    def test_create(self, app, db_session):

        StreamFactory(name='streamy')
        prop1 = ProposalFactory()
        prop2 = ProposalFactory()
        p = PersonFactory(roles=[RoleFactory(name='reviewer')])

        ProposalStatusFactory(name='Withdrawn')  # Required by code

        db_session.commit()

        do_login(app, p)

        resp = app.get('/proposal/%d/review' % prop1.id)
        resp = resp.maybe_follow()
        f = resp.form
        f['review.score'] = -1
        f['review.comment'] = 'a'
        resp = f.submit()
        resp = resp.follow()  # Failure indicates form validation error

        resp = app.get('/proposal/%d/review' % prop2.id)
        resp = resp.maybe_follow()
        f = resp.form
        f['review.score'] = 2
        f['review.comment'] = 'b'
        resp = f.submit()
        resp = resp.follow()  # Failure indicates form validation error

        db_session.expunge_all()

        revs = Review.find_all()
        assert len(revs) == 2
        assert revs[0].score == -1
        assert revs[0].comment == 'a'
        assert revs[1].score == 2
        assert revs[1].comment == 'b'