Exemple #1
0
    def configure_runtime_test(self, proxy_getter):
        """Configure the runtime system with three tasks."""
        observers = []

        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "A"
        observer.proxy.ConfigureWithTasks.return_value = ["/A/1"]

        observers.append(observer)

        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "B"
        observer.proxy.ConfigureWithTasks.return_value = ["/B/1", "/B/2"]

        observers.append(observer)

        task_proxy = Mock()
        task_proxy.Steps = 1
        proxy_getter.return_value = task_proxy

        install_manager = InstallManager()
        install_manager.on_module_observers_changed(observers)
        proxies = install_manager.collect_configure_runtime_tasks()
        self.assertEqual(proxies, [task_proxy, task_proxy, task_proxy])

        proxy_getter.assert_has_calls(
            [call("A", "/A/1"),
             call("B", "/B/1"),
             call("B", "/B/2")])
    def install_three_tasks_test(self, proxy_getter):
        """Install with three tasks."""
        observers = []

        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "A"
        observer.proxy.InstallWithTasks.return_value = ["/A/1"]

        observers.append(observer)

        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "B"
        observer.proxy.InstallWithTasks.return_value = ["/B/1", "/B/2"]

        observers.append(observer)

        task_proxy = Mock()
        task_proxy.Steps = 1
        proxy_getter.return_value = task_proxy

        install_manager = InstallManager()
        install_manager.on_module_observers_changed(observers)
        main_task = install_manager.install_system_with_task()

        proxy_getter.assert_has_calls([
            call("A", "/A/1"),
            call("B", "/B/1"),
            call("B", "/B/2")
        ])
        self.assertIsInstance(main_task, DBusMetaTask)
        self.assertEqual(main_task.name, "Install the system")
        self.assertEqual(main_task._subtasks, [task_proxy, task_proxy, task_proxy])
    def test_install_three_tasks(self, proxy_getter):
        """Install with three tasks."""
        observers = []

        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "A"
        observer.proxy.InstallWithTasks.return_value = ["/A/1"]

        observers.append(observer)

        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "B"
        observer.proxy.InstallWithTasks.return_value = ["/B/1", "/B/2"]

        observers.append(observer)

        task_proxy = Mock()
        task_proxy.Steps = 1
        proxy_getter.return_value = task_proxy

        install_manager = InstallManager()
        install_manager.on_module_observers_changed(observers)
        proxies = install_manager.collect_install_system_tasks()
        assert proxies == [task_proxy, task_proxy, task_proxy]

        proxy_getter.assert_has_calls(
            [call("A", "/A/1"),
             call("B", "/B/1"),
             call("B", "/B/2")])
 def install_with_no_modules_test(self):
     """Install with no modules."""
     install_manager = InstallManager()
     install_manager.on_module_observers_changed([])
     main_task = install_manager.install_system_with_task()
     self.assertIsInstance(main_task, SystemInstallationTask)
     self.assertEqual(main_task._subtasks, [])
Exemple #5
0
    def install_with_no_tasks_test(self):
        """Install with no tasks."""
        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "A"
        observer.proxy.InstallWithTasks.return_value = []

        install_manager = InstallManager()
        install_manager.on_module_observers_changed([observer])
        proxies = install_manager.collect_install_system_tasks()
        self.assertEqual(proxies, [])
    def install_with_no_tasks_test(self):
        """Install with no tasks."""
        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "A"
        observer.proxy.InstallWithTasks.return_value = []

        install_manager = InstallManager()
        install_manager.on_module_observers_changed([observer])
        main_task = install_manager.install_system_with_task()

        self.assertIsInstance(main_task, SystemInstallationTask)
        self.assertEqual(main_task._subtasks, [])
Exemple #7
0
    def install_one_task_test(self, proxy_getter):
        """Install with one task."""
        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "A"
        observer.proxy.InstallWithTasks.return_value = ["/A/1"]

        task_proxy = Mock()
        task_proxy.Steps = 1
        proxy_getter.return_value = task_proxy

        install_manager = InstallManager()
        install_manager.on_module_observers_changed([observer])
        proxies = install_manager.collect_install_system_tasks()
        self.assertEqual(proxies, [task_proxy])

        proxy_getter.assert_called_once_with("A", "/A/1")
    def install_one_task_test(self, proxy_getter):
        """Install with one task."""
        observer = Mock()
        observer.is_service_available = True
        observer.service_name = "A"
        observer.proxy.InstallWithTasks.return_value = ["/A/1"]

        task_proxy = Mock()
        task_proxy.Steps = 1
        proxy_getter.return_value = task_proxy

        install_manager = InstallManager()
        install_manager.on_module_observers_changed([observer])
        main_task = install_manager.install_system_with_task()

        proxy_getter.assert_called_once_with("A", "/A/1")
        self.assertIsInstance(main_task, SystemInstallationTask)
        self.assertEqual(main_task._subtasks, [task_proxy])
Exemple #9
0
 def install_with_no_modules_test(self):
     """Install with no modules."""
     install_manager = InstallManager()
     install_manager.on_module_observers_changed([])
     proxies = install_manager.collect_install_system_tasks()
     self.assertEqual(proxies, [])
 def test_install_with_no_modules(self):
     """Install with no modules."""
     install_manager = InstallManager()
     install_manager.on_module_observers_changed([])
     proxies = install_manager.collect_install_system_tasks()
     assert proxies == []