Esempio n. 1
0
 def test_get_set_is_persistent_keystore(self):
     """Checks default persist value and set method."""
     # checks default
     assert Settings.is_persistent_keystore() is False
     # checks set
     Settings.set_is_persistent_keystore(True)
     assert Settings.is_persistent_keystore() is True
Esempio n. 2
0
 def load_settings(self):
     """Load json store settings to UI properties."""
     self.is_stored_mainnet = Settings.is_stored_mainnet()
     self.is_stored_testnet = Settings.is_stored_testnet()
     self.stored_gas_price = Settings.get_stored_gas_price()
     is_persistent_keystore = (Settings.is_persistent_keystore()
                               and check_write_permission())
     self.set_persist_keystore_switch_state(is_persistent_keystore)
Esempio n. 3
0
 def store_is_persistent_keystore(self):
     """
     Saves the persistency option to the store.
     Note that to save `True` we also check if we have write permissions.
     """
     persist_keystore = self.is_ui_persistent_keystore()
     persist_keystore = persist_keystore and check_write_permission()
     persistency_toggled = (Settings.is_persistent_keystore() !=
                            persist_keystore)
     if persistency_toggled:
         self.sync_keystore(persist_keystore)
     Settings.set_is_persistent_keystore(persist_keystore)
Esempio n. 4
0
 def test_get_android_keystore_prefix(self):
     """
     The keystore prefix should be the same as user_data_dir by default.
     But it can also be persisted to the sdcard.
     """
     assert Settings.is_persistent_keystore() is False
     prefix = Settings._get_android_keystore_prefix()
     assert prefix == self.app.user_data_dir
     with mock.patch.object(Settings,
                            'is_persistent_keystore',
                            return_value=True):
         prefix = Settings._get_android_keystore_prefix()
     assert prefix == '/sdcard/etheroll'