Пример #1
0
def test_vote_for_article_twice_returns_already_voted_result(
        voting_user_who_has_voted: VotingUser,
        article_id_for_which_user_has_voted: ArticleId, a_vote: Vote,
        expected_already_voted_result: AlreadyVotedResult):
    voting_result = voting_user_who_has_voted.vote_for_article(
        article_id_for_which_user_has_voted, a_vote)
    assert voting_result == expected_already_voted_result
Пример #2
0
def voting_user() -> VotingUser:
    return VotingUser(UserId(
        UUID('5e3f29f9-0000-0000-0000-000000000000')), Karma(10), [
            ArticleVote(
                ArticleId(UUID('c313a2b3-0000-0000-0000-000000000000')),
                UserId(UUID('5e3f29f9-0000-0000-0000-000000000000')), Vote.UP)
        ])
Пример #3
0
def voting_user_who_has_voted() -> VotingUser:
    return VotingUser(UserId(
        UUID('06aee517-0000-0000-0000-000000000000')), Karma(100), [
            ArticleVote(
                ArticleId(UUID('171f2557-0000-0000-0000-000000000000')),
                UserId(UUID('06aee517-0000-0000-0000-000000000000')), Vote.UP)
        ])
Пример #4
0
def voting_user_who_has_voted() -> VotingUser:
    return VotingUser(UserId(
        UUID('7ebd50e7-0000-0000-0000-000000000000')), Karma(10), [
            ArticleVote(
                ArticleId(UUID('4df32c92-0000-0000-0000-000000000000')),
                UserId(UUID('7ebd50e7-0000-0000-0000-000000000000')),
                Vote.DOWN)
        ])
Пример #5
0
def test_cannot_vote_for_article_with_insufficient_karma(
        voting_user_with_insufficient_karma_for_voting: VotingUser,
        an_article_id: ArticleId, a_vote: Vote,
        expected_insufficient_karma_result: InsufficientKarmaResult):
    voting_result = voting_user_with_insufficient_karma_for_voting.vote_for_article(
        an_article_id, a_vote)

    assert voting_result == expected_insufficient_karma_result
Пример #6
0
def test_vote_for_article_returns_successfully_voted_result(
        voting_user_who_has_not_voted: VotingUser,
        article_id_for_which_user_has_voted: ArticleId,
        expected_successfully_voted_result: SuccessfullyVotedResult):
    voting_result = voting_user_who_has_not_voted.vote_for_article(
        article_id_for_which_user_has_voted, Vote.DOWN)

    assert voting_result == expected_successfully_voted_result
def saved_voting_user() -> VotingUser:
    return VotingUser(
        UserId(UUID('bd971243-0000-0000-0000-000000000000')),
        Karma(10),
        [
            ArticleVote(
                ArticleId(UUID('c77fc6c4-0000-0000-0000-000000000000')),
                UserId(UUID('bd971243-0000-0000-0000-000000000000')),
                Vote.UP
            )
        ]
    )
Пример #8
0
def voting_user_with_insufficient_karma_for_voting() -> VotingUser:
    return VotingUser(UserId(UUID('d826bff6-0000-0000-0000-000000000000')),
                      Karma(4), [])
Пример #9
0
def voting_user_who_has_not_voted() -> VotingUser:
    return VotingUser(UserId(UUID('c23ec6da-0000-0000-0000-000000000000')),
                      Karma(10), [])
 def find_voting_user(self, article_id: ArticleId, user_id: UserId) -> VotingUser:
     return VotingUser(user_id, Karma(10))
Пример #11
0
def voting_user_who_has_not_voted() -> VotingUser:
    return VotingUser(UserId(UUID('06aee517-0000-0000-0000-000000000000')),
                      Karma(100), [])