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
def test_response_to_reg(reg_header): assert Comment._response_to(reg_header) == "2"
def test_response_to(unreg_header): assert Comment._response_to(unreg_header) is None
def test_censored_comments_page(censored_page): comments = Comment.comments_from_html(censored_page) assert comments[0].censored
def test_izolate_timestamp(unreg_header): ts = Comment._izolate_timestamp(unreg_header) assert ts >= 1423601580