def test_call_upstart_launch(self, gcai):
        class FakeUpstartBase(_l.ApplicationLauncher):
            launch_call_args = []

            def launch(self, *args):
                FakeUpstartBase.launch_call_args = list(args)

        patcher = patch.object(_l.ClickApplicationLauncher, '__bases__',
                               (FakeUpstartBase, ))
        with patcher:
            # Prevent mock from trying to delete __bases__
            patcher.is_local = True
            launcher = self.useFixture(_l.ClickApplicationLauncher())
            launcher.launch('', '')
            self.assertEqual(launcher.launch_call_args,
                             [gcai.return_value, []])
    def test_call_get_click_app_id(self, gcai):
        class FakeUpstartBase(_l.ApplicationLauncher):
            launch_call_args = []

            def launch(self, *args):
                FakeUpstartBase.launch_call_args = list(args)

        patcher = patch.object(_l.ClickApplicationLauncher, '__bases__',
                               (FakeUpstartBase, ))
        token_a = self.getUniqueString()
        token_b = self.getUniqueString()
        with patcher:
            # Prevent mock from trying to delete __bases__
            patcher.is_local = True
            launcher = self.useFixture(_l.ClickApplicationLauncher())
            launcher.launch(token_a, token_b)
        gcai.assert_called_once_with(token_a, token_b)
    def test_handle_bytes(self, gcai):
        class FakeUpstartBase(_l.ApplicationLauncher):
            launch_call_args = []

            def launch(self, *args):
                FakeUpstartBase.launch_call_args = list(args)

        patcher = patch.object(_l.ClickApplicationLauncher, '__bases__',
                               (FakeUpstartBase, ))
        token = self.getUniqueString()
        with patcher:
            # Prevent mock from trying to delete __bases__
            patcher.is_local = True
            launcher = self.useFixture(_l.ClickApplicationLauncher())
            launcher.launch('', '', token.encode())
        self.assertEqual(FakeUpstartBase.launch_call_args,
                         [gcai.return_value, [token]])