Exemplo n.º 1
0
def test_censored_comment(censored_comment):
    assert not Comment._response_to(censored_comment)

    c = Comment._from_head_and_body(
        censored_comment.find("div", {"class": "ds_hlavicka"})[0],
        censored_comment.find("div", {"id": "comment1"})[0])

    assert c.url == "https://www.abclinuxu.cz/blog/show/240961#1"
    assert "administrátor" in c.text
    assert c.timestamp == 1222777500
    assert c.username == ""
    assert not c.registered
    assert c.responses == []

    assert not c.response_to
    assert c.id == "1"
Exemplo n.º 2
0
def test_censored_comment(censored_comment):
    assert not Comment._response_to(censored_comment)

    c = Comment._from_head_and_body(
        censored_comment.find("div", {"class": "ds_hlavicka"})[0],
        censored_comment.find("div", {"id": "comment1"})[0]
    )

    assert c.url == "https://www.abclinuxu.cz/blog/show/240961#1"
    assert "administrátor" in c.text
    assert c.timestamp == 1222777500
    assert c.username == ""
    assert not c.registered
    assert c.responses == []

    assert not c.response_to
    assert c.id == "1"
Exemplo n.º 3
0
def test_parse_url_reg(reg_header):
    assert Comment._parse_url(reg_header) == BLOG_URL + "#9"
Exemplo n.º 4
0
def test_parse_url(unreg_header):
    assert Comment._parse_url(unreg_header) == BLOG_URL + "#3"
Exemplo n.º 5
0
def test_izolate_name_reg(reg_header):
    username, registered = Comment._izolate_username(reg_header)

    assert username == "manasekp"
    assert registered
Exemplo n.º 6
0
def test_izolate_name(unreg_header):
    username, registered = Comment._izolate_username(unreg_header)

    assert username == "Tomáškova máma"
    assert not registered
Exemplo n.º 7
0
def test_izolate_timestamp_reg(reg_header):
    ts = Comment._izolate_timestamp(reg_header)

    assert ts >= 1423664460
Exemplo n.º 8
0
def test_izolate_timestamp_reg(reg_header):
    ts = Comment._izolate_timestamp(reg_header)

    assert ts >= 1423664460
Exemplo n.º 9
0
def test_response_to_reg(reg_header):
    assert Comment._response_to(reg_header) == "2"
Exemplo n.º 10
0
def test_parse_url_reg(reg_header):
    assert Comment._parse_url(reg_header) == BLOG_URL + "#9"
Exemplo n.º 11
0
def test_response_to(unreg_header):
    assert Comment._response_to(unreg_header) is None
Exemplo n.º 12
0
def test_parse_url(unreg_header):
    assert Comment._parse_url(unreg_header) == BLOG_URL + "#3"
Exemplo n.º 13
0
def test_izolate_name_reg(reg_header):
    username, registered = Comment._izolate_username(reg_header)

    assert username == "manasekp"
    assert registered
Exemplo n.º 14
0
def test_izolate_name(unreg_header):
    username, registered = Comment._izolate_username(unreg_header)

    assert username == "Tomáškova máma"
    assert not registered
Exemplo n.º 15
0
def test_response_to(unreg_header):
    assert Comment._response_to(unreg_header) is None
Exemplo n.º 16
0
def test_censored_comments_page(censored_page):
    comments = Comment.comments_from_html(censored_page)

    assert comments[0].censored
Exemplo n.º 17
0
def test_response_to_reg(reg_header):
    assert Comment._response_to(reg_header) == "2"
Exemplo n.º 18
0
def test_izolate_timestamp(unreg_header):
    ts = Comment._izolate_timestamp(unreg_header)

    assert ts >= 1423601580
Exemplo n.º 19
0
def test_censored_comments_page(censored_page):
    comments = Comment.comments_from_html(censored_page)

    assert comments[0].censored
Exemplo n.º 20
0
def test_izolate_timestamp(unreg_header):
    ts = Comment._izolate_timestamp(unreg_header)

    assert ts >= 1423601580