Example #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"
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"
def test_parse_url_reg(reg_header):
    assert Comment._parse_url(reg_header) == BLOG_URL + "#9"
def test_parse_url(unreg_header):
    assert Comment._parse_url(unreg_header) == BLOG_URL + "#3"
def test_izolate_name_reg(reg_header):
    username, registered = Comment._izolate_username(reg_header)

    assert username == "manasekp"
    assert registered
def test_izolate_name(unreg_header):
    username, registered = Comment._izolate_username(unreg_header)

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

    assert ts >= 1423664460
Example #8
0
def test_izolate_timestamp_reg(reg_header):
    ts = Comment._izolate_timestamp(reg_header)

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

    assert username == "manasekp"
    assert registered
Example #14
0
def test_izolate_name(unreg_header):
    username, registered = Comment._izolate_username(unreg_header)

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

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

    assert ts >= 1423601580
Example #19
0
def test_censored_comments_page(censored_page):
    comments = Comment.comments_from_html(censored_page)

    assert comments[0].censored
Example #20
0
def test_izolate_timestamp(unreg_header):
    ts = Comment._izolate_timestamp(unreg_header)

    assert ts >= 1423601580