def test__sanitize_issue_list_shows_your_votes_during_voting(): your_token = 'a-token' your_issue = retro.create_mock_issue(section='your_section', creator_token=your_token, votes={'another-different-token'}) another_issue = retro.create_mock_issue( section='special_section', creator_token='a-different-token', votes={your_token, 'another-different-token'}) a_retro = retro.create_mock_retro(current_step=RetroStep.VOTING, issues=[your_issue, another_issue]) sanitized_issues = Service._sanitize_issue_list(a_retro, your_token) assert len(sanitized_issues) == 2 was_your_issue = sanitized_issues[0] assert was_your_issue['id'] == your_issue.id assert was_your_issue['title'] == your_issue.title assert was_your_issue['section'] == your_issue.section assert was_your_issue['votes'] == 0 was_another_issue = sanitized_issues[1] assert was_another_issue['id'] == another_issue.id assert was_another_issue['title'] == another_issue.title assert was_another_issue['section'] == another_issue.section assert was_another_issue['votes'] == 1
def test__sanitize_issue_list_shows_my_issues_and_other_sections_during_adding_issues( ): user_token = 'a-token' your_issue = retro.create_mock_issue(section='your_section', creator_token=user_token, votes={user_token}) another_issue = retro.create_mock_issue(section='special_section', creator_token='a-different-token') a_retro = retro.create_mock_retro(current_step=RetroStep.ADDING_ISSUES, issues=[your_issue, another_issue]) sanitized_issues = Service._sanitize_issue_list(a_retro, user_token) assert len(sanitized_issues) == 2 was_your_issue = sanitized_issues[0] assert was_your_issue['id'] == your_issue.id assert was_your_issue['title'] == your_issue.title assert was_your_issue['section'] == your_issue.section with pytest.raises(KeyError): was_your_issue['votes'] was_another_issue = sanitized_issues[1] assert was_another_issue['section'] == another_issue.section with pytest.raises(KeyError): was_another_issue['title'] with pytest.raises(KeyError): was_another_issue['id'] with pytest.raises(KeyError): was_another_issue['votes']
def test__sanitize_issue_list_doesnt_order_issues_when_not_results(): your_token = 'a-token' the_issue_section = 'a-section' another_issue_section = 'another-section' first_issue = retro.create_mock_issue(id='1', section=the_issue_section, creator_token=your_token, votes=set()) second_issue = retro.create_mock_issue( id='3', section=the_issue_section, creator_token='a-different-token', votes={your_token, 'another-different-token', 'yet-another-token'}) third_issue = retro.create_mock_issue(id='2', section=another_issue_section, creator_token='a-different-token', votes={your_token}) a_retro = retro.create_mock_retro( current_step=RetroStep.VOTING, issues=[first_issue, second_issue, third_issue]) sanitized_issues = Service._sanitize_issue_list(a_retro, your_token) assert sanitized_issues[0]['id'] == first_issue.id assert sanitized_issues[1]['id'] == second_issue.id assert sanitized_issues[2]['id'] == third_issue.id