summaryrefslogtreecommitdiff
path: root/tests/addressbook
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2017-07-09 10:57:58 +0200
committerLucas Hoffmann <l-m-h@web.de>2017-07-17 23:44:29 +0200
commitf1381610c2ec5547ac236aba0fba79d785ece509 (patch)
treede129ebb3661c0ac2616c4fa99ea5a29253ac771 /tests/addressbook
parent003cbfd45264f47121def5b97ef81d3df0e3f884 (diff)
Add another test for ExternalAddressbook
Diffstat (limited to 'tests/addressbook')
-rw-r--r--tests/addressbook/external_test.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/addressbook/external_test.py b/tests/addressbook/external_test.py
index 2211769e..99aacfd3 100644
--- a/tests/addressbook/external_test.py
+++ b/tests/addressbook/external_test.py
@@ -30,6 +30,14 @@ class TestExternalAddressbookGetContacts(unittest.TestCase):
expected = u'abook command "foobar" returned with return code 42'
self.assertEqual(contextmgr.exception.args[0], expected)
+ def test_stderr_of_failing_command_is_part_of_exception_message(self):
+ stderr = 'some text printed on stderr of external command'
+ abook = external.ExternalAddressbook('foobar', '')
+ with self._patch_call_cmd(('', stderr, 42)):
+ with self.assertRaises(external.AddressbookError) as contextmgr:
+ abook.get_contacts()
+ self.assertIn(stderr, contextmgr.exception.args[0])
+
def test_returns_empty_list_when_command_returns_no_output(self):
abook = external.ExternalAddressbook('foobar', self.regex)
with self._patch_call_cmd(('', '', 0)) as call_cmd: