# Path: alot/addressbook/external.py
# class ExternalAddressbook(AddressBook):
#     def __init__(self, commandline, regex, reflags=0,
#                  external_filtering=True,
#                  **kwargs):
#     def get_contacts(self):
#     def lookup(self, prefix):  # pragma: no cover
#     def _call_and_parse(self, commandline):


import re
import unittest
from unittest import mock
from alot.addressbook import external
# Copyright (C) 2017  Lucas Hoffmann
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file



class TestExternalAddressbookGetContacts(unittest.TestCase):

    """Some test cases for
    alot.addressbook.external.ExternalAddressbook.get_contacts"""

    regex = '(?P<name>.*)\t(?P<email>.*)'

    @staticmethod
    def _patch_call_cmd(return_value):
        return mock.patch('alot.addressbook.external.call_cmd',
                          mock.Mock(return_value=return_value))

    def test_raises_if_external_command_exits_with_non_zero_status(self):

# Path: alot/addressbook/external.py
# class ExternalAddressbook(AddressBook):
#     def __init__(self, commandline, regex, reflags=0,
#                  external_filtering=True,
#                  **kwargs):
#     def get_contacts(self):
#     def lookup(self, prefix):  # pragma: no cover
#     def _call_and_parse(self, commandline):


# Path: tests/addressbook/test_external.py
import re
import unittest
from unittest import mock
from alot.addressbook import external

# Copyright (C) 2017  Lucas Hoffmann
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file



class TestExternalAddressbookGetContacts(unittest.TestCase):

    """Some test cases for
    alot.addressbook.external.ExternalAddressbook.get_contacts"""

    regex = '(?P<name>.*)\t(?P<email>.*)'

    @staticmethod
    def _patch_call_cmd(return_value):
        return mock.patch('alot.addressbook.external.call_cmd',
                          mock.Mock(return_value=return_value))

    def test_raises_if_external_command_exits_with_non_zero_status(self):

        abook = external.ExternalAddressbook('foobar', '')