示例#1
0
def test_blackberry_signature():
    msg_body = """Heeyyoooo.
Sent wirelessly from my BlackBerry device on the Bell network.
Envoyé sans fil par mon terminal mobile BlackBerry sur le réseau de Bell."""
    eq_(("Heeyyoooo.", msg_body[len("Heeyyoooo.\n") :]), bruteforce.extract_signature(msg_body))

    msg_body = u"""Blah
Enviado desde mi oficina móvil BlackBerry® de Telcel"""

    eq_(("Blah", u"Enviado desde mi oficina móvil BlackBerry® de Telcel"), bruteforce.extract_signature(msg_body))
示例#2
0
def test_blackberry_signature():
    msg_body = """Heeyyoooo.
Sent wirelessly from my BlackBerry device on the Bell network.
Envoyé sans fil par mon terminal mobile BlackBerry sur le réseau de Bell."""
    eq_(('Heeyyoooo.', msg_body[len('Heeyyoooo.\n'):]),
        bruteforce.extract_signature(msg_body))

    msg_body = u"""Blah
Enviado desde mi oficina móvil BlackBerry® de Telcel"""

    eq_(('Blah', u'Enviado desde mi oficina móvil BlackBerry® de Telcel'),
        bruteforce.extract_signature(msg_body))
示例#3
0
def test_blank_lines_inside_signature():
    msg_body = """Blah.

-Lev.

Sent from my HTC smartphone!"""
    eq_(("Blah.", "-Lev.\n\nSent from my HTC smartphone!"), bruteforce.extract_signature(msg_body))

    msg_body = """Blah
--

John Doe"""
    eq_(("Blah", "--\n\nJohn Doe"), bruteforce.extract_signature(msg_body))
示例#4
0
def test_blank_lines_inside_signature():
    msg_body = '''Blah.

-Lev.

Sent from my HTC smartphone!'''
    eq_(('Blah.', '-Lev.\n\nSent from my HTC smartphone!'),
        bruteforce.extract_signature(msg_body))

    msg_body = '''Blah
--

John Doe'''
    eq_(('Blah', '--\n\nJohn Doe'), bruteforce.extract_signature(msg_body))
示例#5
0
def test_line_starts_with_signature_word():
    msg_body = """Hey man!
Thanks for your attention.
--
Thanks!
Roman"""
    eq_(("Hey man!\nThanks for your attention.", "--\nThanks!\nRoman"), bruteforce.extract_signature(msg_body))
示例#6
0
def test_line_starts_with_signature_word():
    msg_body = '''Hey man!
Thanks for your attention.
--
Thanks!
Roman'''
    eq_(('Hey man!\nThanks for your attention.', '--\nThanks!\nRoman'),
        bruteforce.extract_signature(msg_body))
示例#7
0
def test_line_starts_with_dashes():
    msg_body = """Hey man!
Look at this:

--> one
--> two
--
Roman"""
    eq_(("Hey man!\nLook at this:\n\n--> one\n--> two", "--\nRoman"), bruteforce.extract_signature(msg_body))
示例#8
0
def test_signature_cant_start_from_first_line():
    msg_body = """Thanks,

Blah

regards

John Doe"""
    eq_(("Thanks,\n\nBlah", "regards\n\nJohn Doe"), bruteforce.extract_signature(msg_body))
示例#9
0
def test_signature_max_lines_ignores_empty_lines():
    msg_body = """Thanks,
Blah

regards


John Doe"""
    eq_(("Thanks,\nBlah", "regards\n\n\nJohn Doe"), bruteforce.extract_signature(msg_body))
示例#10
0
def test_signature_separated_by_dashes():
    msg_body = """Hey man! How r u?
---
Roman"""
    eq_(("Hey man! How r u?", "---\nRoman"), bruteforce.extract_signature(msg_body))

    msg_body = """Hey!
-roman"""
    eq_(("Hey!", "-roman"), bruteforce.extract_signature(msg_body))

    msg_body = """Hey!

- roman"""
    eq_(("Hey!", "- roman"), bruteforce.extract_signature(msg_body))

    msg_body = """Wow. Awesome!
--
Bob Smith"""
    eq_(("Wow. Awesome!", "--\nBob Smith"), bruteforce.extract_signature(msg_body))
示例#11
0
def test_line_starts_with_dashes():
    msg_body = '''Hey man!
Look at this:

--> one
--> two
--
Roman'''
    eq_(('Hey man!\nLook at this:\n\n--> one\n--> two', '--\nRoman'),
        bruteforce.extract_signature(msg_body))
示例#12
0
def test_signature_cant_start_from_first_line():
    msg_body = """Thanks,

Blah

regards

John Doe"""
    eq_(('Thanks,\n\nBlah', 'regards\n\nJohn Doe'),
        bruteforce.extract_signature(msg_body))
示例#13
0
def test_signature_max_lines_ignores_empty_lines():
    msg_body = """Thanks,
Blah

regards


John Doe"""
    eq_(('Thanks,\nBlah', 'regards\n\n\nJohn Doe'),
        bruteforce.extract_signature(msg_body))
示例#14
0
def test_signature_words():
    msg_body = """Hey!

Thanks!
Roman"""
    eq_(("Hey!", "Thanks!\nRoman"), bruteforce.extract_signature(msg_body))

    msg_body = """Hey!
--
Best regards,

Roman"""
    eq_(("Hey!", "--\nBest regards,\n\nRoman"), bruteforce.extract_signature(msg_body))

    msg_body = """Hey!
--
--
Regards,
Roman"""
    eq_(("Hey!", "--\n--\nRegards,\nRoman"), bruteforce.extract_signature(msg_body))
示例#15
0
def test_signature_separated_by_dashes():
    msg_body = '''Hey man! How r u?
---
Roman'''
    eq_(('Hey man! How r u?', '---\nRoman'),
        bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!
-roman'''
    eq_(('Hey!', '-roman'), bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!

- roman'''
    eq_(('Hey!', '- roman'), bruteforce.extract_signature(msg_body))

    msg_body = '''Wow. Awesome!
--
Bob Smith'''
    eq_(('Wow. Awesome!', '--\nBob Smith'),
        bruteforce.extract_signature(msg_body))
示例#16
0
def test_signature_words():
    msg_body = '''Hey!

Thanks!
Roman'''
    eq_(('Hey!', 'Thanks!\nRoman'), bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!
--
Best regards,

Roman'''
    eq_(('Hey!', '--\nBest regards,\n\nRoman'),
        bruteforce.extract_signature(msg_body))

    msg_body = '''Hey!
--
--
Regards,
Roman'''
    eq_(('Hey!', '--\n--\nRegards,\nRoman'),
        bruteforce.extract_signature(msg_body))
示例#17
0
def test_empty_body():
    eq_(('', None), bruteforce.extract_signature(''))
示例#18
0
def test_mailbox_for_iphone_signature():
    msg_body = """Blah
Sent from Mailbox for iPhone"""
    eq_(("Blah", "Sent from Mailbox for iPhone"),
        bruteforce.extract_signature(msg_body))
示例#19
0
def test_iphone_signature():
    msg_body = '''Hey!

Sent from my iPhone!'''
    eq_(('Hey!', 'Sent from my iPhone!'),
        bruteforce.extract_signature(msg_body))
示例#20
0
def test_signature_only():
    msg_body = '--\nRoman'
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
示例#21
0
def test_empty_body():
    eq_(("", None), bruteforce.extract_signature(""))
示例#22
0
def test_crash_in_extract_signature():
    msg_body = '''Hey!
-roman'''
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
示例#23
0
def test_signature_only():
    msg_body = "--\nRoman"
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
示例#24
0
def test_no_signature():
    msg_body = 'Hey man!'
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
示例#25
0
def test_crash_in_extract_signature():
    msg_body = """Hey!
-roman"""
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
示例#26
0
def test_iphone_signature():
    msg_body = """Hey!

Sent from my iPhone!"""
    eq_(("Hey!", "Sent from my iPhone!"), bruteforce.extract_signature(msg_body))
示例#27
0
def test_no_signature():
    msg_body = "Hey man!"
    eq_((msg_body, None), bruteforce.extract_signature(msg_body))
示例#28
0
def test_mailbox_for_iphone_signature():
    msg_body = """Blah
Sent from Mailbox for iPhone"""
    eq_(("Blah", "Sent from Mailbox for iPhone"), bruteforce.extract_signature(msg_body))