def test_create_account_nonexistent_asset(): '''Test that we can't create an account for an asset that doesn't exist''' fake_id = Nym().create()._id # just to get a plausible asset id fake_asset = Asset(_id=fake_id, server_id=server.first_active_id()) acct = account.Account(fake_asset, Nym().register()) with error.expected(ReturnValueError): acct.create()
def test_create_account(): server_id = server.first_id() nym = Nym().register(server_id) asset = Asset().issue(nym, open(data.btc_contract_file), server_id) myacct = account.Account(asset, nym).create() accounts = account.get_all_ids() assert myacct._id in accounts
def an_account(): '''Generates a test account (non-issuer)''' nym = Nym().register() asset = Asset().issue(nym, open(data.btc_contract_file)) return account.Account(asset, Nym().register())
def test_two_accounts_same_nym_and_asset(an_account): '''Test that a nym can create two accounts of the same asset type''' second_account = account.Account(an_account.asset, an_account.nym).create() assert an_account._id != second_account._id
def test_account_nym_not_registered(): nym = Nym().register() asset = Asset().issue(nym, open(data.btc_contract_file)) with error.expected(ReturnValueError): account.Account(asset, Nym().create()).create()
def __init__(self): self.asset = Asset().issue(Nym().register(), open(btc_contract_file)) self.source = account.Account(self.asset, Nym().register()).create() self.target = account.Account(self.asset, Nym().register()).create() self.issuer = self.asset.issuer_account