Exemplo n.º 1
0
 def test_get_or_create(self):
     """
     Checks if the singleton is handled properly.
     It should only be different when changing keystore_dir.
     """
     account_utils = AccountUtils.get_or_create(self.keystore_dir)
     assert account_utils == AccountUtils.get_or_create(self.keystore_dir)
     with TemporaryDirectory() as keystore_dir:
         assert account_utils != AccountUtils.get_or_create(keystore_dir)
         assert AccountUtils.get_or_create(keystore_dir) == \
             AccountUtils.get_or_create(keystore_dir)
Exemplo n.º 2
0
 def account_utils(self):
     """
     Gets or creates the AccountUtils object so it loads lazily.
     """
     from ethereum_utils import AccountUtils
     keystore_dir = Settings.get_keystore_path()
     return AccountUtils.get_or_create(keystore_dir)