Esempio n. 1
0
 def test_unit__find_key_from_mail_subadress__err_not_alphanum(self):
     mail_address = "*****@*****.**"
     with pytest.raises(AssertionError):
         DecodedMail.find_key_from_mail_address(
             mail_address,
             marker_str="{key}",
             pattern="reply+{key}@mydomainname.tld")
Esempio n. 2
0
 def test_unit__decoded_mail__check_validity_for_comment_content__ok__nominal_case(self):
     message = Message()
     uid = 1
     decodedmail = DecodedMail(message, uid)
     try:
         decodedmail.check_validity_for_comment_content()
     except AutoReplyEmailNotAllowed:
         pytest.fail("mail is seen as autoreply mail but it is not")
Esempio n. 3
0
 def test_unit__find_key_from_mail_subadress__err_not_alphanum(self):
     mail_address = "*****@*****.**"
     with pytest.raises(AssertionError):
         DecodedMail.find_key_from_mail_address(
             mail_address,
             marker_str='{key}',
             pattern='reply+{key}@mydomainname.tld'
         )
Esempio n. 4
0
    def test_unit__decoded_mail__check_validity_for_comment_content__err__is_autoreply_email(
        self, header_name, header_value
    ):
        message = Message()
        message.add_header(header_name, header_value)

        uid = 1
        decodedmail = DecodedMail(message, uid)
        with pytest.raises(AutoReplyEmailNotAllowed):
            decodedmail.check_validity_for_comment_content()
Esempio n. 5
0
 def test_unit__find_key_from_mail_address__subadress_no_key(self):
     mail_address = "*****@*****.**"
     assert DecodedMail.find_key_from_mail_address(
         mail_address,
         marker_str='{key}',
         pattern='reply+{key}@mydomainname.tld'
     ) is None
Esempio n. 6
0
 def test_unit__find_key_from_mail_address__adress_explicit_key(self):
     mail_address = "*****@*****.**"
     assert DecodedMail.find_key_from_mail_address(
         mail_address,
         marker_str='{key}',
         pattern='cid{key}@reply.mydomainname.tld'
     ) == '12'
Esempio n. 7
0
 def test_unit__find_key_from_mail_dot_adress_key(self):
     mail_address = "*****@*****.**"
     assert DecodedMail.find_key_from_mail_address(
         mail_address,
         marker_str='{key}',
         pattern='reply.{key}@mydomainname.tld'
     ) == 'key'
Esempio n. 8
0
 def test_unit__find_key_from_mail_address__dot_adress_no_key(self):
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="reply.{key}@mydomainname.tld"
         )
         is None
     )
Esempio n. 9
0
 def test_unit__find_key_from_mail_subadress__err_not_alphanum(self):
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="reply+{key}@mydomainname.tld"
         )
         is None
     )
Esempio n. 10
0
 def test_unit__find_key_from_mail_subadress_adress_key(self):
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="reply+{key}@mydomainname.tld"
         )
         == "12"
     )
Esempio n. 11
0
 def test_unit__find_key_from_mail_address__adress_explicit_key(self):
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="cid{key}@reply.mydomainname.tld"
         )
         == "12"
     )
Esempio n. 12
0
 def test_unit__find_key_from_mail_address__explicit_subadress_no_key(self):
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="z+cid{key}@b"
         )
         is None
     )
Esempio n. 13
0
 def test_unit__find_key_from_mail_address__no_key_in_pattern(self):
     """
     Automatically failed to obtain key when pattern as no key
     """
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="*****@*****.**"
         )
         is None
     )
Esempio n. 14
0
 def test_unit__find_key_from_mail_address__multiple_key(self):
     """
     Automatically failed to obtain key when pattern as multiple key.
     """
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="{key}reply{key}@mydomainname.tld"
         )
         is None
     )
Esempio n. 15
0
 def test_unit__find_key_from_mail_address__mismatch_pattern(self):
     """
     Automatically failed to obtain key when pattern don't match
     """
     mail_address = "*****@*****.**"
     assert (
         DecodedMail.find_key_from_mail_address(
             mail_address, marker_str="{key}", pattern="toto+{key}@mydomainname.tld"
         )
         is None
     )