def loadAddressList(user_ID): """Load a list with all address from the user """ addrList = [] conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() cursor.execute("""SELECT addr FROM addrList WHERE user_ID=? ORDER BY num""", (user_ID,)) for addr in cursor.fetchall(): addrList.append(Address.fromJson(addr[0])) conn.close() return addrList
def fromJson(data): data = json.loads(data) sender_public_key = Address.fromJson(data["sender_public_key"]) t = Transaction(sender_public_key, data["receivers"]) t.signature = data["signature"] return t
def test_public_json(self): a = Address().public() b = Address.fromJson(a.toJson()) self.assertTrue(self.equalAddresses(a, b, False))
def test_encrypted_json(self): a = Address() a.encryptPrivateKey('pwd') b = Address.fromJson(a.toJson()) self.assertTrue(self.equalAddresses(a, b, False, True))
def test_json_equal(self): a = Address() b = Address.fromJson(a.toJson()) self.assertEqual(a.toJson(), b.toJson())
def test_json(self): a = Address() b = Address.fromJson(a.toJson()) self.assertTrue(self.equalAddresses(a, b))