Exemplo n.º 1
0
def test_signing_keystore_load():

    a = Account.load_from_keystore(
        os.path.join(os.path.dirname(os.path.realpath(__file__)), "testdata",
                     "keystore.json"), "aeternity")
    assert a.get_address(
    ) == "ak_Jt6AzQEiXiEMFXum8NtTXcCQtE9P1RfpkeVSZX87pFddzzynW"
Exemplo n.º 2
0
def test_signing_keystore_save_load_wrong_pwd():
    with tempdir() as tmp_path:
        filename = ACCOUNT.save_to_keystore(tmp_path, "whatever")
        path = os.path.join(tmp_path, filename)
        print(f"\nAccount keystore is {path}")
        # now load again the same
        with raises(ValueError):
            a = Account.load_from_keystore(path, "nononon")
            assert a.get_address() == ACCOUNT.get_address()
Exemplo n.º 3
0
def test_signing_keystore_save_load():
    with tempdir() as tmp_path:
        filename = ACCOUNT.save_to_keystore(tmp_path, "whatever")
        path = os.path.join(tmp_path, filename)
        print(f"\nAccount keystore is {path}")
        # now load again the same
        a = Account.load_from_keystore(path, "whatever")
        assert a.get_address() == ACCOUNT.get_address()
    with tempdir() as tmp_path:
        filename = "account_ks"
        filename = ACCOUNT.save_to_keystore(tmp_path,
                                            "whatever",
                                            filename=filename)
        path = os.path.join(tmp_path, filename)
        print(f"\nAccount keystore is {path}")
        # now load again the same
        a = Account.load_from_keystore(path, "whatever")
        assert a.get_address() == ACCOUNT.get_address()