Exemple #1
0
def error_check_entry_from_host():
    host_list = HostList('error_check_entry_from_host')
    host = 'http://list-iptv.com'
    host_list.database().hosts.insert({'host': host, 'running': False})
    host_list.database().hosts.insert({'host': host, 'running': False})
    with pytest.raises(MultipleEntriesInDatabaseError):
        host_list.entry_from_host(host)

    for invalid in [[], set(), 'fat', 'reddit.com']:
        with pytest.raises(InvalidUrlError):
            host_list.entry_from_host(invalid)

    host_list.delete()
Exemple #2
0
def test_entry_from_host():
    host_list = HostList('test_entry_from_host')
    host1 = 'http://list-iptv.com'
    host2 = 'http://ramalin.com'
    host3 = 'http://m3uliste.com'
    for host in [host1, host2, host3]:
        host_list.add_to_hosts(host)
        entry = host_list.entry_from_host(host)
        assert entry is not None
        assert entry['host'] == host
        assert entry['running'] is False

    host_list.delete()
Exemple #3
0
def test_update_running():
    host_list = HostList('test_update_running')
    host1 = 'http://list-iptv.com'
    host2 = 'http://ramalin.com'
    host3 = 'http://m3uliste.com'
    for host in [host1, host2, host3]:
        host_list.add_to_hosts(host)

    order = []

    while host_list.find_not_running_entry() is not None:
        entry = host_list.find_not_running_entry()
        host = entry['host']
        host_list.update_running(host, True)
        order.append(host)

    for host in [host1, host2, host3]:
        assert host_list.entry_from_host(host)['running'] is True

    assert order == [host1, host2, host3]

    host_list.delete()