# Path: tests/base.py
# LOG = oslo_logging.getLogger(__name__)
# class TestCase(base.BaseTestCase):
#     def setUp(self):
#     def _common_cleanup(self):
#     def log_level(self, level):
#     def mock_object(self, obj, attr_name, new_attr=None, **kwargs):
#     def assertDictMatch(self, d1, d2, approx_equal=False, tolerance=0.001):
#         def raise_assertion(msg):
# 
# Path: virtman/imageservice.py
# LOG = logging.getLogger(__name__)
# def create_image_target(image_name, file_path, loop_dev, iqn_prefix):
# def destroy_image_target(image_name):
# def list_image_target():
# 
# Path: virtman/blockservice.py
# LOG = logging.getLogger(__name__)
# def findloop():
# def try_linkloop(loop_dev):
# def is_looped(loop_dev):
# def linkloop(loop_dev, path):
# def unlinkloop(loop_dev):
# 
# Path: virtman/drivers/iscsi.py
# class TgtExecutor(TgtAdm):
#     def __init__(self, root_helper='', volumes_dir='/etc/tgt/stack.d'):
# def create_iscsi_target(iqn, path):
# def remove_iscsi_target(vol_id, vol_name):
# def exists(iqn):
# def is_connected(target_id):
# 
# Path: virtman/openstack/common/processutils.py
# LOG = logging.getLogger(__name__)
#             _PIPE = subprocess.PIPE  # pylint: disable=E1101
# class InvalidArgumentError(Exception):
# class UnknownArgumentError(Exception):
# class ProcessExecutionError(Exception):
# class NoRootWrapSpecified(Exception):
#     def __init__(self, message=None):
#     def __init__(self, message=None):
#     def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None,
#                  description=None):
#     def __init__(self, message=None):
# def _subprocess_setup():
# def execute(*cmd, **kwargs):
# def trycmd(*args, **kwargs):
# def ssh_execute(ssh, cmd, process_input=None,
#                 addl_env=None, check_exit_code=True):


import mock
import os
import string
from tests import base
from virtman import imageservice
from virtman import blockservice
from virtman.drivers import iscsi
from virtman.openstack.common import processutils as putils
# -*- coding: utf-8 -*-



test_iqn_prefix = 'iqn.2010-10.org.test:'


class TestImageService(base.TestCase):
    def setUp(self):
        super(TestImageService, self).setUp()
        self.cmds = []
        self.mock_object(putils, 'execute',
                         mock.Mock(side_effect=self.fake_execute))

    def fake_execute(self, *cmd, **kwargs):
        self.cmds.append(string.join(cmd))
        return "", None

    def test_create_image_target(self):


# Path: tests/base.py
# LOG = oslo_logging.getLogger(__name__)
# class TestCase(base.BaseTestCase):
#     def setUp(self):
#     def _common_cleanup(self):
#     def log_level(self, level):
#     def mock_object(self, obj, attr_name, new_attr=None, **kwargs):
#     def assertDictMatch(self, d1, d2, approx_equal=False, tolerance=0.001):
#         def raise_assertion(msg):
# 
# Path: virtman/imageservice.py
# LOG = logging.getLogger(__name__)
# def create_image_target(image_name, file_path, loop_dev, iqn_prefix):
# def destroy_image_target(image_name):
# def list_image_target():
# 
# Path: virtman/blockservice.py
# LOG = logging.getLogger(__name__)
# def findloop():
# def try_linkloop(loop_dev):
# def is_looped(loop_dev):
# def linkloop(loop_dev, path):
# def unlinkloop(loop_dev):
# 
# Path: virtman/drivers/iscsi.py
# class TgtExecutor(TgtAdm):
#     def __init__(self, root_helper='', volumes_dir='/etc/tgt/stack.d'):
# def create_iscsi_target(iqn, path):
# def remove_iscsi_target(vol_id, vol_name):
# def exists(iqn):
# def is_connected(target_id):
# 
# Path: virtman/openstack/common/processutils.py
# LOG = logging.getLogger(__name__)
#             _PIPE = subprocess.PIPE  # pylint: disable=E1101
# class InvalidArgumentError(Exception):
# class UnknownArgumentError(Exception):
# class ProcessExecutionError(Exception):
# class NoRootWrapSpecified(Exception):
#     def __init__(self, message=None):
#     def __init__(self, message=None):
#     def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None,
#                  description=None):
#     def __init__(self, message=None):
# def _subprocess_setup():
# def execute(*cmd, **kwargs):
# def trycmd(*args, **kwargs):
# def ssh_execute(ssh, cmd, process_input=None,
#                 addl_env=None, check_exit_code=True):


# Path: tests/test_imageservice.py
import mock
import os
import string
from tests import base
from virtman import imageservice
from virtman import blockservice
from virtman.drivers import iscsi
from virtman.openstack.common import processutils as putils

# -*- coding: utf-8 -*-



test_iqn_prefix = 'iqn.2010-10.org.test:'


class TestImageService(base.TestCase):
    def setUp(self):
        super(TestImageService, self).setUp()
        self.cmds = []
        self.mock_object(putils, 'execute',
                         mock.Mock(side_effect=self.fake_execute))

    def fake_execute(self, *cmd, **kwargs):
        self.cmds.append(string.join(cmd))
        return "", None

    def test_create_image_target(self):


        self.mock_object(iscsi, 'create_iscsi_target',