def test_getVoteAbstainAlias(self): """Test the abstain alias of 0.""" command = VoteEmailCommand('vote', ['0']) self.assertVoteAndTag(CodeReviewVote.ABSTAIN, None, command) command = VoteEmailCommand('vote', ['+0']) self.assertVoteAndTag(CodeReviewVote.ABSTAIN, None, command) command = VoteEmailCommand('vote', ['-0']) self.assertVoteAndTag(CodeReviewVote.ABSTAIN, None, command)
def test_getVoteNeedsFixingAlias(self): """Test the needs_fixing aliases of needsfixing and needs-fixing.""" command = VoteEmailCommand('vote', ['needs_fixing']) self.assertVoteAndTag(CodeReviewVote.NEEDS_FIXING, None, command) command = VoteEmailCommand('vote', ['needsfixing']) self.assertVoteAndTag(CodeReviewVote.NEEDS_FIXING, None, command) command = VoteEmailCommand('vote', ['needs-fixing']) self.assertVoteAndTag(CodeReviewVote.NEEDS_FIXING, None, command)
def test_getVoteNeedsInfoAlias(self): """Test the needs_info review type and its aliases.""" command = VoteEmailCommand('vote', ['needs_info']) self.assertVoteAndTag(CodeReviewVote.NEEDS_INFO, None, command) command = VoteEmailCommand('vote', ['needsinfo']) self.assertVoteAndTag(CodeReviewVote.NEEDS_INFO, None, command) command = VoteEmailCommand('vote', ['needs-info']) self.assertVoteAndTag(CodeReviewVote.NEEDS_INFO, None, command) command = VoteEmailCommand('vote', ['needs_information']) self.assertVoteAndTag(CodeReviewVote.NEEDS_INFO, None, command) command = VoteEmailCommand('vote', ['needsinformation']) self.assertVoteAndTag(CodeReviewVote.NEEDS_INFO, None, command) command = VoteEmailCommand('vote', ['needs-information']) self.assertVoteAndTag(CodeReviewVote.NEEDS_INFO, None, command)
def test_getVoteDisapproveAlias(self): """Test the disapprove alias of -1.""" command = VoteEmailCommand('vote', ['-1']) self.assertVoteAndTag(CodeReviewVote.DISAPPROVE, None, command)
def test_getVoteApproveAlias(self): """Test the approve alias of +1.""" command = VoteEmailCommand('vote', ['+1']) self.assertVoteAndTag(CodeReviewVote.APPROVE, None, command)
def test_getVoteThreeArg(self): """getVote returns vote, vote_tag when both are supplied.""" command = VoteEmailCommand('vote', ['apPRoVe', 'DB', 'TAG']) self.assertVoteAndTag(CodeReviewVote.APPROVE, 'DB TAG', command)
def test_getVoteBadValue(self): """getVote returns vote, None when only a vote is supplied.""" command = VoteEmailCommand('vote', ['badvalue']) self.assertRaises(EmailProcessingError, command.execute, self.context)
def test_getVoteDisapprove(self): """getVote returns disapprove when it is specified.""" command = VoteEmailCommand('vote', ['dIsAppRoVe']) self.assertVoteAndTag(CodeReviewVote.DISAPPROVE, None, command)
def test_getVoteOneArg(self): """getVote returns vote, None when only a vote is supplied.""" command = VoteEmailCommand('vote', ['apPRoVe']) self.assertVoteAndTag(CodeReviewVote.APPROVE, None, command)
def test_getVoteNoArgs(self): """getVote returns None, None when no arguments are supplied.""" command = VoteEmailCommand('vote', []) self.assertRaises(EmailProcessingError, command.execute, self.context)