def test_must_agree_prev_block():

    class TestVoting(Voting):

        @classmethod
        def verify_vote_schema(cls, vote):
            return True
    voters = 'abcd'
    votes = [Bigchain(v).vote('block', 'a', True) for v in voters]
    votes[0]['vote']['previous_block'] = 'b'
    votes[1]['vote']['previous_block'] = 'c'
    by_voter = dict(enumerate(votes))
    assert (TestVoting.count_votes(by_voter) == {'counts': {'n_valid': 2, 'n_invalid': 2}, 'previous_block': 'a', 'other_previous_block': {'b': 1, 'c': 1}, 'malformed': []})
def test_must_agree_prev_block():

    class TestVoting(Voting):

        @classmethod
        def verify_vote_schema(cls, vote):
            return True
    voters = 'abcd'
    votes = [Bigchain(v).vote('block', 'a', True) for v in voters]
    votes[0]['vote']['previous_block'] = 'b'
    votes[1]['vote']['previous_block'] = 'c'
    by_voter = dict(enumerate(votes))
    assert (TestVoting.count_votes(by_voter) == {'counts': {'n_valid': 2, 'n_invalid': 2}, 'previous_block': 'a', 'other_previous_block': {'b': 1, 'c': 1}, 'malformed': []})