1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-29 00:57:45 +02:00

Test client init error (#448)

* Remove unused import

* Test Client.__init__() with incomplete keypair
This commit is contained in:
Sylvain Bellemare 2016-07-15 11:46:25 +02:00 committed by GitHub
parent 009f9ab05f
commit f4a7ba906f

View File

@ -55,11 +55,20 @@ def test_client_can_create_assets(mock_requests_post, client):
def test_client_can_transfer_assets(mock_requests_post, mock_bigchaindb_sign, client):
from bigchaindb import util
tx = client.transfer(client.public_key, 123)
assert tx['transaction']['fulfillments'][0]['current_owners'][0] == client.public_key
assert tx['transaction']['conditions'][0]['new_owners'][0] == client.public_key
assert tx['transaction']['fulfillments'][0]['input'] == 123
@pytest.mark.parametrize('pubkey,privkey', (
(None, None), ('pubkey', None), (None, 'privkey'),
))
def test_init_client_with_incomplete_keypair(pubkey, privkey, monkeypatch):
from bigchaindb import config
from bigchaindb.client import Client
from bigchaindb.exceptions import KeypairNotFoundException
keypair = {'public': pubkey, 'private': privkey}
monkeypatch.setitem(config, 'keypair', keypair)
with pytest.raises(KeypairNotFoundException):
Client()