def test_store_get_transaction_by_hash():
    service = RedisService()
    t = Transaction("test_hash", '', "test to", "test from", 50.123, 0)
    success = service.store_object(t)
    assert success

    new_t = service.get_object_by_hash("test_hash", Transaction)

    assert t.to_string() == new_t.to_string()
def test_remove_from_mempool():
    ts = TransactionService()
    rs = RedisService()

    t = Transaction('mem_test_hash4', '', 'mem_william', 'mem_naween', 14605,
                    1)
    rs.store_object(t)

    ts.remove_from_mem_pool(t)

    new_t = rs.get_object_by_hash('mem_test_hash4', Transaction)

    print(t.to_string())
    print(new_t.to_string())
    assert new_t.is_mempool == 0