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

    assert username == "manasekp"
    assert registered
コード例 #6
0
def test_izolate_name(unreg_header):
    username, registered = Comment._izolate_username(unreg_header)

    assert username == "Tomáškova máma"
    assert not registered
コード例 #7
0
def test_izolate_timestamp_reg(reg_header):
    ts = Comment._izolate_timestamp(reg_header)

    assert ts >= 1423664460
コード例 #8
0
def test_izolate_timestamp_reg(reg_header):
    ts = Comment._izolate_timestamp(reg_header)

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

    assert username == "manasekp"
    assert registered
コード例 #14
0
def test_izolate_name(unreg_header):
    username, registered = Comment._izolate_username(unreg_header)

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

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

    assert ts >= 1423601580
コード例 #19
0
def test_censored_comments_page(censored_page):
    comments = Comment.comments_from_html(censored_page)

    assert comments[0].censored
コード例 #20
0
def test_izolate_timestamp(unreg_header):
    ts = Comment._izolate_timestamp(unreg_header)

    assert ts >= 1423601580