def test_write_dictionnary_to_file(self): storage = WalletStorage(self.wallet_path) some_dict = {"a": "b", "c": "d"} storage.data = some_dict storage.write() contents = "" with open(self.wallet_path, "r") as f: contents = f.read() self.assertEqual(some_dict, json.loads(contents))
def test_write_dictionnary_to_file(self): storage = WalletStorage(self.wallet_path) some_dict = {"a":"b", "c":"d"} storage.data = some_dict storage.write() contents = "" with open(self.wallet_path, "r") as f: contents = f.read() self.assertEqual(some_dict, json.loads(contents))
def test_write_dictionnary_to_file(self): storage = WalletStorage(self.wallet_path) some_dict = {"a": "b", "c": "d"} for key, value in some_dict.items(): storage.put(key, value) storage.write() contents = "" with open(self.wallet_path, "r") as f: contents = f.read() self.assertEqual(some_dict, json.loads(contents))
def test_write_dictionnary_to_file(self): storage = WalletStorage(self.wallet_path) some_dict = {"a":"b", "c":"d"} for key, value in some_dict.items(): storage.put(key, value) storage.write() contents = "" with open(self.wallet_path, "r") as f: contents = f.read() self.assertEqual(some_dict, json.loads(contents))
def test_write_dictionnary_to_file(self): path = os.path.join(self.user_dir, "somewallet") self.fake_config.set("wallet_path", path) storage = WalletStorage(self.fake_config) some_dict = {"a": "b", "c": "d"} storage.data = some_dict storage.write() contents = "" with open(path, "r") as f: contents = f.read() self.assertEqual(some_dict, json.loads(contents))
def test_write_dictionnary_to_file(self): path = os.path.join(self.user_dir, "somewallet") self.fake_config.set("wallet_path", path) storage = WalletStorage(self.fake_config) some_dict = {"a":"b", "c":"d"} storage.data = some_dict storage.write() contents = "" with open(path, "r") as f: contents = f.read() self.assertEqual(some_dict, json.loads(contents))