[tor-commits] [gettor/master] Add more test cases for different email styles

cohosh at torproject.org cohosh at torproject.org
Thu Mar 12 17:14:14 UTC 2020


commit c8e385babeee9e46b04261e12d777107de38a16d
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Fri Feb 14 16:15:33 2020 -0500

    Add more test cases for different email styles
    
    teor mentioned in ticket #23225 that some clients will top-post replies
    without quoting the the text. This commit adds a test case for that.
    Since the command detector is greedy, gettor parses the reply first.
    
    Also added a test for bottom-posting.
---
 tests/test_email_service.py | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/tests/test_email_service.py b/tests/test_email_service.py
index 995ba55..71c3d4f 100644
--- a/tests/test_email_service.py
+++ b/tests/test_email_service.py
@@ -239,6 +239,39 @@ class EmailServiceTests(unittest.TestCase):
 
         request = ep.parse("From: \"silvia [hiro]\" <hiro at torproject.org>\n"
                 "Subject: Re: [GetTor] Help Email\r\n Reply-To: hiro at torproject.org \nTo:"
+                "gettor at torproject.org\nlinux fa\n\n"
+                "On 2020-02-10 11:54 a.m., gettor at torproject.org wrote:\n"
+                "This is how you can request a tor browser bundle link.\n"
+                "\n"
+                "Send an email to: gettor at torproject.org\n"
+                "\n"
+                "In the body of the email only write: <operating system> <language>.\n"
+                "\n"
+                "We only support windows, osx and linux as operating systems.\n"
+                "\n")
+        self.assertEqual(request["command"], "links")
+        self.assertEqual(request["language"], "fa")
+        self.assertEqual(request["platform"], "linux")
+
+        request = ep.parse("From: \"silvia [hiro]\" <hiro at torproject.org>\n"
+                "Subject: Re: [GetTor] Help Email\r\n Reply-To: hiro at torproject.org \nTo:"
+                "gettor at torproject.org\n"
+                "On 2020-02-10 11:54 a.m., gettor at torproject.org wrote:\n"
+                "> This is how you can request a tor browser bundle link.\n"
+                ">\n"
+                "> Send an email to: gettor at torproject.org\n"
+                ">\n"
+                "> In the body of the email only write: <operating system> <language>.\n"
+                ">\n"
+                "> We only support windows, osx and linux as operating systems.\n"
+                ">\n"
+                "linux fa\n\n")
+        self.assertEqual(request["command"], "links")
+        self.assertEqual(request["language"], "fa")
+        self.assertEqual(request["platform"], "linux")
+
+        request = ep.parse("From: \"silvia [hiro]\" <hiro at torproject.org>\n"
+                "Subject: Re: [GetTor] Help Email\r\n Reply-To: hiro at torproject.org \nTo:"
                 "gettor at torproject.org\n"
                 "On 2020-02-10 11:54 a.m., gettor at torproject.org wrote:\n"
                 "> This is how you can request a tor browser bundle link.\n"





More information about the tor-commits mailing list