summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-04-07 14:56:11 +0300
committerLars Wirzenius <liw@liw.fi>2017-04-07 14:56:11 +0300
commit6b7f99939141afebbc88f5ec68a083fda738da4b (patch)
tree8c95e610e9506b27ba7c42bc2979274486f493e6
parent451ac50d4b2473326c23c9203be27388da0465cc (diff)
downloaddistix-6b7f99939141afebbc88f5ec68a083fda738da4b.tar.gz
A rudimentary get_ids_from_message
-rw-r--r--distixlib/__init__.py1
-rw-r--r--distixlib/msg_id_extractor.py21
-rw-r--r--distixlib/msg_id_extractor_tests.py36
3 files changed, 58 insertions, 0 deletions
diff --git a/distixlib/__init__.py b/distixlib/__init__.py
index 8f0c20d..ee2471d 100644
--- a/distixlib/__init__.py
+++ b/distixlib/__init__.py
@@ -40,6 +40,7 @@ from .message_thread import MessageThread
from .message_renderer import MessageRenderer
from .repo import Repository
from .git import Git
+from .msg_id_extractor import get_ids_from_message
from .text_renderer import TextRenderer
from .html_renderer import HtmlRenderer
from .util import get_ticket_ids
diff --git a/distixlib/msg_id_extractor.py b/distixlib/msg_id_extractor.py
new file mode 100644
index 0000000..cbe985d
--- /dev/null
+++ b/distixlib/msg_id_extractor.py
@@ -0,0 +1,21 @@
+# Copyright 2017 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# =*= License: GPL-3+ =*=
+
+
+
+def get_ids_from_message(msg):
+ return []
diff --git a/distixlib/msg_id_extractor_tests.py b/distixlib/msg_id_extractor_tests.py
new file mode 100644
index 0000000..6a7e259
--- /dev/null
+++ b/distixlib/msg_id_extractor_tests.py
@@ -0,0 +1,36 @@
+# Copyright 2017 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# =*= License: GPL-3+ =*=
+
+
+import email
+import unittest
+
+import distixlib
+
+
+class GetIdFromMessageTests(unittest.TestCase):
+
+ def test_returns_empty_list_if_no_ids(self):
+ msg = email.message_from_string('''\
+From: user@example.com
+To: other@example.com
+Subject: O, Romeo
+
+Wherefore art thou?
+''')
+
+ self.assertEqual(distixlib.get_ids_from_message(msg), [])