Exemplo n.º 1
0
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()
Exemplo n.º 2
0
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
Exemplo n.º 3
0
def test_issue_asset_contract(issue_for_other_nym, expect_success):
    server_id = server.first_id()
    nym = Nym().register(server_id)
    issue_for_nym = Nym().register(server_id) if issue_for_other_nym else nym
    with error.expected(None if expect_success else ReturnValueError):
        Asset().issue(nym,
                      open(data.btc_contract_file),
                      server_id,
                      issue_for_nym=issue_for_nym)
Exemplo n.º 4
0
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())
Exemplo n.º 5
0
def test_two_assets_same_nym_and_contract():
    '''Should be able to create two asset types with the same contract'''
    nym = Nym().register()
    asset1 = Asset().issue(nym, open(data.btc_contract_file))
    asset2 = Asset().issue(nym, open(data.btc_contract_file))
    assert asset1._id != asset2._id
Exemplo n.º 6
0
def test_asset_count_increments():
    then = opentxs.OTAPI_Wrap_GetAssetTypeCount()
    Asset().issue(Nym().register(), open(data.btc_contract_file))
    now = opentxs.OTAPI_Wrap_GetAssetTypeCount()
    assert then + 1 == now
Exemplo n.º 7
0
def test_asset_nym_not_registered():
    with error.expected(ReturnValueError):
        Asset().issue(Nym().create(), open(data.btc_contract_file))
Exemplo n.º 8
0
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()
Exemplo n.º 9
0
def an_asset():
    return Asset().issue(Nym().register(), open(data.btc_contract_file))
Exemplo n.º 10
0
    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