Harden dedicated-IP parser against real IPRoyal response (proxy_data.ip/ports/user/pass)
This commit is contained in:
27
test_poll.py
Normal file
27
test_poll.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import db
|
||||
import time
|
||||
import app
|
||||
|
||||
db.init_db()
|
||||
d = db.get_db()
|
||||
d.execute("DELETE FROM dedicated_ips WHERE iproyal_order_id=82970019")
|
||||
d.execute("INSERT INTO dedicated_ips (user_id,product_id,product_name,plan_days,location_id,"
|
||||
"location_name,iproyal_order_id,status,price_sats,created_at) "
|
||||
"VALUES (2,3,'Datacenter Dedicated',30,201,'United States - Ashburn (Virginia)',"
|
||||
"82970019,'provisioning',10000,?)", (int(time.time()),))
|
||||
d.commit()
|
||||
d.close()
|
||||
print("inserted test row (order 82970019, status=provisioning)")
|
||||
|
||||
ok, failed = app.poll_provisioning()
|
||||
print(f"poll_provisioning -> provisioned={ok} failed={failed}")
|
||||
|
||||
d = db.get_db()
|
||||
r = d.execute("SELECT * FROM dedicated_ips WHERE iproyal_order_id=82970019").fetchone()
|
||||
d.close()
|
||||
print("RESULT ROW:")
|
||||
for k in r.keys():
|
||||
v = r[k]
|
||||
if k == "proxy_pass":
|
||||
v = ("*" * len(v)) if v else ""
|
||||
print(f" {k} = {v}")
|
||||
Reference in New Issue
Block a user