Пример #1
0
def test_vote_for_issue(mock_send_retro_update):
    issue_id_str = 'issue_id'
    user_token_str = 'voter_token'
    a_issue = retro.create_mock_issue(id=issue_id_str)
    a_retro = retro.create_mock_retro(issues=[a_issue])

    Service.vote_for_issue(a_issue, user_token_str, a_retro)

    assert 1 == len(a_issue.votes)
    assert user_token_str in a_issue.votes
    mock_send_retro_update.assert_called_once()
Пример #2
0
def test_vote_for_issue_twice_results_in_one_vote(mock_send_retro_update):
    issue_id_str = 'issue_id'
    user_token_str = 'voter_token'
    a_issue = retro.create_mock_issue(id=issue_id_str)
    a_retro = retro.create_mock_retro(issues=[a_issue])

    Service.vote_for_issue(a_issue, user_token_str, a_retro)
    Service.vote_for_issue(a_issue, user_token_str, a_retro)

    assert 1 == len(a_issue.votes)
    assert user_token_str in a_issue.votes
    assert 2 == mock_send_retro_update.call_count