Esempio n. 1
0
def test_links():
    res = lt.send_request(domain)
    r = lt.links(res)
    wikis = lt.links(res, search='wiki')
    assert isinstance(r, list)
    assert '#' not in r and '' not in r
    assert len(set(r)) == len(r)
    assert all(['wiki' in wiki for wiki in wikis])
Esempio n. 2
0
def test_links():
    res = requests.get(lt.ensure_schema(f'{domain}/post'))
    r = lt.links(res)
    search_imgs = lt.links(res, search='image')
    re_imgs = lt.links(res, pattern='.*/image/.*')
    assert isinstance(r, list)
    assert '#' not in r and '' not in r
    assert len(set(r)) == len(r)
    assert all(['image' in img for img in search_imgs])
    assert all(['image' in img for img in re_imgs])
Esempio n. 3
0
def get_tasklist(url):
    res = lt.send_request(url)
    categories = lt.links(res, search='/cp')
    tasklist = [
        f'{domain}/pg{n}-{c[1:]}' for c in categories for n in range(1, 101)
    ]
    return tasklist
Esempio n. 4
0
def test_links():
    res = lt.send_request(domain)
    r = lt.links(res)
    assert type(r) == list and '#' not in r
Esempio n. 5
0
def test_absolute_links():
    res = lt.send_request('http://www.spbeen.com')
    hrefs = [href.replace('http://','') for href in lt.links(res, absolute=True)]
    assert len([href for href in hrefs if "//" in href])==0