| 1 |
import unittest |
| 2 |
import six |
| 3 |
from unittest.mock import MagicMock |
| 4 |
from bugwarrior.services import Issue |
| 5 |
|
| 6 |
|
| 7 |
class StringCompatTest(unittest.TestCase): |
| 8 |
"""This class implements method to test correct and compatible |
| 9 |
implementation of __str__ and __repr__ methods""" |
| 10 |
|
| 11 |
def test_issue_str(self): |
| 12 |
"check Issue class" |
| 13 |
record = {} |
| 14 |
origin = {'target': 'target', |
| 15 |
'default_priority': 'prio', |
| 16 |
'templates': 'templates', |
| 17 |
'add_tags': []} |
| 18 |
issue = Issue(record, origin) |
| 19 |
issue.to_taskwarrior = MagicMock(return_value=record) |
| 20 |
issue.get_default_description = MagicMock(return_value='description') |
| 21 |
self.assertIsInstance(str(issue), six.string_types) |
| 22 |
self.assertIsInstance(issue.__repr__(), six.string_types) |
| 23 |
self.assertTrue(six.PY3 or hasattr(issue, '__unicode__')) |