Пример #1
0
def test_save_ip():
    p1 = ProxyIP(ip='192.168.0.1',
                 port=443,
                 provider='Foo',
                 latency=200,
                 stability=0.5)
    save_ip(p1)
    # basically the same ip
    p2 = ProxyIP(ip='192.168.0.1',
                 port=443,
                 provider='Foo',
                 latency=200,
                 stability=0.5)
    save_ip(p2)
    count = ProxyIP.select().where(ProxyIP.ip == '192.168.0.1').count()

    assert count == 1

    p3 = ProxyIP(ip='192.168.0.1',
                 port=80,
                 provider='Foo',
                 latency=200,
                 stability=0.5)
    save_ip(p3)
    count = ProxyIP.select().where(ProxyIP.ip == '192.168.0.1').count()

    assert count == 2

    ProxyIP.delete().execute()
Пример #2
0
def test_delete_ip():
    ret = ProxyIP.delete().execute()
    print(ret)
Пример #3
0
def delete_test_ip(ip_str: str):
    ProxyIP.delete().where(ProxyIP.ip == ip_str).execute()