def test_client_knows_nym_registered(): me = Nym().create() assert not opentxs.OTAPI_Wrap_IsNym_RegisteredAtServer(me._id, server.first_active_id()) me.register() assert opentxs.OTAPI_Wrap_IsNym_RegisteredAtServer(me._id, me.server_id) me.delete() assert not opentxs.OTAPI_Wrap_IsNym_RegisteredAtServer(me._id, server.first_active_id())
def test_client_knows_nym_registered(): me = Nym().create() assert not opentxs.OTAPI_Wrap_IsNym_RegisteredAtServer( me._id, server.first_active_id()) me.register() assert opentxs.OTAPI_Wrap_IsNym_RegisteredAtServer(me._id, me.server_id) me.delete() assert not opentxs.OTAPI_Wrap_IsNym_RegisteredAtServer( me._id, server.first_active_id())
def test_set_name(newname): newname = newname() if callable(newname) else newname n = Nym().create() origname = "Joe" n.set_name(origname) assert n.get_name() == origname n.register() n.set_name(newname) assert n.get_name() == newname n.register()
def test_withdraw_voucher_to_unregistered_nym(prepared_accounts, recipient_is_blank): unreg_nym = Nym().create() v = instrument.Voucher(prepared_accounts.source.server_id, 50, prepared_accounts.source, prepared_accounts.source.nym, "test cheque!", None if recipient_is_blank else unreg_nym) v.withdraw() # now register the nym and deposit unreg_nym.register() new_acct = Account(prepared_accounts.source.asset, unreg_nym).create() v.deposit(unreg_nym, new_acct) prepared_accounts.assert_balances(-100, 50, 0)
def test_withdraw_voucher_to_unregistered_nym(prepared_accounts, recipient_is_blank): unreg_nym = Nym().create() v = instrument.Voucher( prepared_accounts.source.server_id, 50, prepared_accounts.source, prepared_accounts.source.nym, "test cheque!", None if recipient_is_blank else unreg_nym ) v.withdraw() # now register the nym and deposit unreg_nym.register() new_acct = Account(prepared_accounts.source.asset, unreg_nym).create() v.deposit(unreg_nym, new_acct) prepared_accounts.assert_balances(-100, 50, 0)
def test_write_cheque_to_unregistered_nym(self, prepared_accounts, recipient_is_blank): unreg_nym = Nym().create() now = datetime.utcnow() c = instrument.Cheque(prepared_accounts.source.server_id, 50, now + timedelta(0, -1000), now + timedelta(0, 1000), prepared_accounts.source, prepared_accounts.source.nym, "test cheque!", None if recipient_is_blank else unreg_nym) c.write() # now register the nym and deposit unreg_nym.register() new_acct = Account(prepared_accounts.source.asset, unreg_nym).create() c.deposit(unreg_nym, new_acct) prepared_accounts.assert_balances(-100, 50, 0)
def test_write_cheque_to_unregistered_nym(self, prepared_accounts, recipient_is_blank): unreg_nym = Nym().create() now = datetime.utcnow() c = instrument.Cheque( prepared_accounts.source.server_id, 50, now + timedelta(0, -1000), now + timedelta(0, 1000), prepared_accounts.source, prepared_accounts.source.nym, "test cheque!", None if recipient_is_blank else unreg_nym ) c.write() # now register the nym and deposit unreg_nym.register() new_acct = Account(prepared_accounts.source.asset, unreg_nym).create() c.deposit(unreg_nym, new_acct) prepared_accounts.assert_balances(-100, 50, 0)
def test_reregister_nym(): n = Nym().register() n.delete() n.register()