def test_invalid_info_len(self): created = base.create(self.btctxstore, self.wif, "info", []) # repack to eliminate namedtuples and simulate io repacked = umsgpack.unpackb(umsgpack.packb(created)) self.assertIsNone(info.read(self.btctxstore, repacked))
def test_invalid_storage_value_types(self): _info = ["0.0.0", [None, 0, 0], None, None] created = base.create(self.btctxstore, self.wif, "info", _info) # repack to eliminate namedtuples and simulate io repacked = umsgpack.unpackb(umsgpack.packb(created)) self.assertIsNone(info.read(self.btctxstore, repacked))
def test_invalid_version_value(self): _info = ["invalidversion", None, None, None] created = base.create(self.btctxstore, self.wif, "info", _info) # repack to eliminate namedtuples and simulate io repacked = umsgpack.unpackb(umsgpack.packb(created)) self.assertIsNone(info.read(self.btctxstore, repacked))
def test_invalid_platform_len(self): _info = ["0.0.0", [2, 1, 1], [["127.0.0.1", 1337], "unl", True], []] created = base.create(self.btctxstore, self.wif, "info", _info) # repack to eliminate namedtuples and simulate io repacked = umsgpack.unpackb(umsgpack.packb(created)) self.assertIsNone(info.read(self.btctxstore, repacked))
def test_invalid_network_ip(self): _info = ["0.0.0", [2, 1, 1], [["invalid", None], "unl", True], None] created = base.create(self.btctxstore, self.wif, "info", _info) # repack to eliminate namedtuples and simulate io repacked = umsgpack.unpackb(umsgpack.packb(created)) self.assertIsNone(info.read(self.btctxstore, repacked))
def test_create_read(self): # test create capacity = {"total": 1024 ** 6, "used": 1024 ** 6, "free": 0} transport = ["127.0.0.1", 1337] created = info.create(self.btctxstore, self.wif, capacity, transport, "unl", True) # repack to eliminate namedtuples and simulate io repacked = umsgpack.unpackb(umsgpack.packb(created)) # test read read = info.read(self.btctxstore, repacked) self.assertIsNotNone(read) self.assertEqual(created, read)
def test_invalid_message(self): self.assertIsNone(info.read(self.btctxstore, None))