# Path: conjureup/controllers/juju/deploy/common.py
# async def do_deploy(msg_cb):
# async def wait_for_applications(msg_cb):


import asyncio
import unittest
from unittest.mock import MagicMock, patch
from conjureup.controllers.juju.deploy import common
from .helpers import AsyncMock, test_loop
        self.mock_app = self.app_patcher.start()
        self.mock_app.ui = MagicMock(name="app.ui")
        self.events_app_patcher = patch('conjureup.events.app', self.mock_app)
        self.events_app_patcher.start()
        self.utils_patcher = patch(
            'conjureup.controllers.deploy.common.utils'
        )
        self.mock_utils = self.utils_patcher.start()
        self.juju_patcher = patch(
            'conjureup.controllers.deploy.common.juju')
        self.mock_juju = self.juju_patcher.start()
        self.mock_app.juju.client.deploy = AsyncMock()

    def tearDown(self):
        self.app_patcher.stop()
        self.utils_patcher.stop()
        self.events_app_patcher.stop()
        self.juju_patcher.stop()

    @patch('conjureup.controllers.juju.deploy.common.os.path.join')
    def test_do_deploy(self, mock_join):
        "call do_deploy"
        mock_join.return_value = '/tmp/path'
        msg_cb = MagicMock()
        with test_loop() as loop:
            # have to patch out the event because the existing one is
            # attached to a different event loop
            new_event = asyncio.Event(loop=loop)
            new_event.set()
            with patch('conjureup.events.ModelConnected', new_event):

# Path: conjureup/controllers/juju/deploy/common.py
# async def do_deploy(msg_cb):
# async def wait_for_applications(msg_cb):


# Path: test/controllers_juju/test_controllers_deploy_common.py
import asyncio
import unittest
from unittest.mock import MagicMock, patch
from conjureup.controllers.juju.deploy import common
from .helpers import AsyncMock, test_loop

        self.mock_app = self.app_patcher.start()
        self.mock_app.ui = MagicMock(name="app.ui")
        self.events_app_patcher = patch('conjureup.events.app', self.mock_app)
        self.events_app_patcher.start()
        self.utils_patcher = patch(
            'conjureup.controllers.deploy.common.utils'
        )
        self.mock_utils = self.utils_patcher.start()
        self.juju_patcher = patch(
            'conjureup.controllers.deploy.common.juju')
        self.mock_juju = self.juju_patcher.start()
        self.mock_app.juju.client.deploy = AsyncMock()

    def tearDown(self):
        self.app_patcher.stop()
        self.utils_patcher.stop()
        self.events_app_patcher.stop()
        self.juju_patcher.stop()

    @patch('conjureup.controllers.juju.deploy.common.os.path.join')
    def test_do_deploy(self, mock_join):
        "call do_deploy"
        mock_join.return_value = '/tmp/path'
        msg_cb = MagicMock()
        with test_loop() as loop:
            # have to patch out the event because the existing one is
            # attached to a different event loop
            new_event = asyncio.Event(loop=loop)
            new_event.set()
            with patch('conjureup.events.ModelConnected', new_event):

                loop.run_until_complete(common.do_deploy(msg_cb))