def test_testgiver_getaccount_address(self): t = TonlibClientAsyncio() coro = t.testgiver_getaccount_address() res = coro_result(coro) self.assertIsInstance(res, dict) self.assertEqual('accountAddress', res['@type']) self.assertEqual(self.testgiver_address, res['account_address'])
def test_testgiver_getaccount_address(self): t = TonlibClientAsyncio() coro = t.testgiver_getaccount_address() res = coro_result(coro) self.assertIsInstance(res, dict) self.assertEqual(res['@type'], 'accountAddress') self.assertEqual(res['account_address'], 'Ef+BVndbeTJeXWLnQtm5bDC2UVpc0vH2TF2ksZPAPwcODSkb')
class TonlibTestAsyncCase2(unittest.TestCase): keystore = os.path.join(proj_path, 'tmp') vect = '23454927' * 5 local_password = '******' key_password = '******' mn = Mnemonic("english") mn_phrase = mn.to_mnemonic(unhexlify(vect)).split(' ') t = TonlibClientAsyncio(keystore=keystore) def _create_new_key(self): coro = self.t.create_new_key(local_password=self.local_password, mnemonic=self.mn_phrase) res = coro_result(coro) self.assertIsInstance(res, dict) self.assertEqual(res['@type'], 'key') return res def _delete_key(self, public_key, secret): coro = self.t.delete_key(public_key=public_key, secret=secret) res = coro_result(coro) self.assertIsInstance(res, dict) self.assertEqual(res['@type'], 'ok') def setUp(self): uvloop.install() def test_export_key(self): res_create_new_key = self._create_new_key() coro_export_key = self.t.export_key( public_key=res_create_new_key['public_key'], secret=res_create_new_key['secret'], local_password=self.local_password) res_export_key = coro_result(coro_export_key) self.assertIsInstance(res_export_key, dict) self.assertEqual(res_export_key['@type'], 'exportedKey') self._delete_key(public_key=res_create_new_key['public_key'], secret=res_create_new_key['secret'])
def test_testgiver_getaccount_state_parallel(self): t = TonlibClientAsyncio(threads=5) coros = [t.testgiver_getaccount_state() for _ in range(10)] ress = [coro_result(coro) for coro in coros] [self.assertIsInstance(r, dict) for r in ress] [self.assertEqual(r['@type'], 'testGiver.accountState') for r in ress]
def test_testgiver_getaccount_state(self): t = TonlibClientAsyncio() coro = t.testgiver_getaccount_state() res = coro_result(coro) self.assertIsInstance(res, dict) self.assertEqual(res['@type'], 'testGiver.accountState')