def test_take_review_requires_reviewer(): cr1 = creator1() vuln = Vulnerability(state=VulnerabilityState.READY, creator=cr1) with pytest.raises(TransitionDenied): vuln.update_state(VulnerabilityState.IN_REVIEW) assert vuln.state == VulnerabilityState.READY
def test_publish_requires_version(): vuln = Vulnerability(state=VulnerabilityState.REVIEWED) with pytest.raises(TransitionDenied): vuln.update_state(VulnerabilityState.PUBLISHED) assert vuln.state == VulnerabilityState.REVIEWED
def test_deny_change_requires_feedback(): vuln = Vulnerability(state=VulnerabilityState.IN_REVIEW) with pytest.raises(TransitionDenied): vuln.update_state(VulnerabilityState.NEEDS_IMPROVEMENT) assert vuln.state == VulnerabilityState.IN_REVIEW
def test_state_matrix(src_state, dst_state, exc): cr1 = creator1() vuln = Vulnerability(state=src_state, creator=cr1) if exc: with pytest.raises(exc): vuln.update_state(dst_state) else: vuln.update_state(dst_state)
def test_return_review_requires_reviewer_reset(): rev = reviewer() vuln = Vulnerability(state=VulnerabilityState.IN_REVIEW, reviewer=rev) with pytest.raises(TransitionDenied): vuln.update_state(VulnerabilityState.READY) assert vuln.state == VulnerabilityState.IN_REVIEW