def test_unit__is_gmail_signature_yes(self): html = '<div class="gmail_extra">' + \ '<a></a><div class="gmail_signature"></div>' + \ '</div>' soup = BeautifulSoup(html, 'html.parser') main_elem = soup.find() assert HtmlMailSignatureChecker._is_gmail_signature(main_elem) is True
def _distinct_elements(cls, tree: BeautifulSoup) -> HtmlBodyMailParts: parts = HtmlBodyMailParts() for elem in list(tree): part_txt = str(elem) part_type = BodyMailPartType.Main if HtmlMailQuoteChecker.is_quote(elem): part_type = BodyMailPartType.Quote elif HtmlMailSignatureChecker.is_signature(elem): part_type = BodyMailPartType.Signature part = BodyMailPart(part_txt, part_type) parts.append(part) # INFO - G.M - 2017-11-28 - Outlook.com special case # all after quote tag is quote if HtmlMailQuoteChecker._is_outlook_com_quote(elem): parts.follow = True return parts
def test_unit__is_gmail_signature_yes_2(self): html = '<div class="gmail_signature">' + "</div>" soup = BeautifulSoup(html, "html.parser") main_elem = soup.find() assert HtmlMailSignatureChecker._is_gmail_signature(main_elem) is True
def test_unit__is_gmail_signature_no(self): soup = BeautifulSoup('<div class="nothing"></div>', "html.parser") main_elem = soup.find() assert HtmlMailSignatureChecker._is_gmail_signature(main_elem) is False
def test_unit__is_gmail_signature_ok(self): html = '<div class="gmail_extra">' + '<a></a><div class="gmail_quote"></div>' + "</div>" soup = BeautifulSoup(html, "html.parser") main_elem = soup.find() assert HtmlMailSignatureChecker._is_gmail_signature(main_elem) is False
def test_unit__is_thunderbird_signature_ok(self): soup = BeautifulSoup('<div class="moz-signature"></div>', "html.parser") main_elem = soup.find() assert HtmlMailSignatureChecker._is_thunderbird_signature( main_elem) is True
def test_unit__is_outlook_com_signature_ok(self): soup = BeautifulSoup('<div id="Signature"></div>', "html.parser") main_elem = soup.find() assert HtmlMailSignatureChecker._is_outlook_com_signature( main_elem) is True
def test_unit__is_thunderbird_signature_no(self): soup = BeautifulSoup('<div class="other"></div>', 'html.parser') main_elem = soup.find() assert HtmlMailSignatureChecker._is_thunderbird_signature( main_elem) is False # nopep8
def test_unit__is_outlook_com_signature_no(self): soup = BeautifulSoup('<div id="divRplyFwdMsg"></div>', 'html.parser') main_elem = soup.find() assert HtmlMailSignatureChecker._is_outlook_com_signature(main_elem) \ is False
def test_unit__is_gmail_signature_no(self): soup = BeautifulSoup('<div class="nothing"></div>', 'html.parser') main_elem = soup.find() assert HtmlMailSignatureChecker._is_gmail_signature(main_elem) is False
def test_unit__is_thunderbird_signature_no(self): soup = BeautifulSoup('<div class="other"></div>', 'html.parser') main_elem = soup.find() assert HtmlMailSignatureChecker._is_thunderbird_signature(main_elem) is False # nopep8
def test_unit__is_outlook_com_signature_ok(self): soup = BeautifulSoup('<div id="Signature"></div>', 'html.parser') main_elem = soup.find() assert HtmlMailSignatureChecker._is_outlook_com_signature(main_elem) \ is True