예제 #1
0
 def test_write(self):
     path = os.path.join(self.electrum_path, 'default_wallet')
     storage = WalletStorage(path)
     data = 'testdata'
     storage.write(data)
     with open(path, 'r') as fd:
         assert fd.read() == data
예제 #2
0
 def test_write_with_permission_error_fails(self):
     path = os.path.join(self.electrum_path, 'default_wallet')
     storage = WalletStorage(path)
     storage.write_attempts = 1
     data = 'testdata'
     with patch('os.replace', new_callable=ReplaceWithPermissionErrorMock):
         with self.assertRaises(PermissionError):
             storage.write(data)
예제 #3
0
 def test_write_with_permission_error_done(self):
     path = os.path.join(self.electrum_path, 'default_wallet')
     storage = WalletStorage(path)
     data = 'testdata'
     with patch('os.replace', new_callable=ReplaceWithPermissionErrorMock):
         storage.write(data)
     with open(path, 'r') as fd:
         assert fd.read() == data