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")
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")
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' )
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()
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
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'
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'
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 )
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 )
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" )
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" )
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 )
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 )
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 )
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 )