From 4216c1733984f4f58c6401c8999afef4bff6ecf4 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Tue, 30 May 2017 14:41:24 +0200 Subject: [PATCH] test Vote.validate_tx transaction exists --- tests/pipelines/test_vote.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pipelines/test_vote.py b/tests/pipelines/test_vote.py index 8ade412e..14830ce5 100644 --- a/tests/pipelines/test_vote.py +++ b/tests/pipelines/test_vote.py @@ -672,3 +672,14 @@ def test_vote_no_double_inclusion(b): b.write_block(block) r = vote.Vote().validate_tx(tx, 'other_block_id', 1) assert r == (False, 'other_block_id', 1) + + +@pytest.mark.genesis +def test_duplicate_transaction(signed_create_tx): + from bigchaindb.pipelines import vote + + with patch('bigchaindb.core.Bigchain.is_new_transaction') as is_new: + is_new.return_value = False + res = vote.Vote().validate_tx(signed_create_tx.to_dict(), 'a', 1) + assert res == (False, 'a', 1) + assert is_new.call_count == 1