diff options
author | Patrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com> | 2014-08-26 22:06:43 +0000 |
---|---|---|
committer | Patrick Maia <pmaia@thoughtworks.com> | 2014-08-26 22:27:48 +0000 |
commit | 6592bfad8cb90d7256de949b181ed9d0b684afec (patch) | |
tree | 0541e5a280ea168d4b8603344449916c5c007593 /service/test/adapter/test_tag.py | |
parent | cf3ea5411adb12dd1bdc12ec01a17b37d974c7c3 (diff) |
extracts tag and status conversion logic
Diffstat (limited to 'service/test/adapter/test_tag.py')
-rw-r--r-- | service/test/adapter/test_tag.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/service/test/adapter/test_tag.py b/service/test/adapter/test_tag.py new file mode 100644 index 00000000..30bc1550 --- /dev/null +++ b/service/test/adapter/test_tag.py @@ -0,0 +1,46 @@ +# +# Copyright (c) 2014 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see <http://www.gnu.org/licenses/>. +import unittest + +from pixelated.adapter.tag import Tag +import test_helper + + +class TestTag(unittest.TestCase): + + def test_leap_recent_flag_is_translated_to_inbox_tag(self): + tag = Tag.from_flag('\\Recent') + self.assertEquals(Tag('inbox'), tag) + + def test_leap_deleted_flag_is_translated_to_trash_tag(self): + tag = Tag.from_flag('\\Deleted') + self.assertEquals(Tag('trash'), tag) + + def test_leap_draft_flag_is_translated_to_draft_tag(self): + tag = Tag.from_flag('\\Draft') + self.assertEquals(Tag('drafts'), tag) + + def test_leap_flags_that_are_custom_tags_are_handled(self): + tag = Tag.from_flag('tag_work') + self.assertEquals(Tag('work'), tag) + + def test_custom_tags_containing_our_prefix_are_handled(self): + tag = Tag.from_flag('tag_tag_work_tag_') + self.assertEquals(Tag('tag_work_tag_'), tag) + + def test_bulk_conversion(self): + tags = Tag.from_flags(['\\Answered', '\\Seen', '\\Recent', 'tag_a_custom', 'List']) + self.assertEquals(set([Tag('inbox'), Tag('a_custom')]), tags) |