def completed(self):
     """Is the spoke complete?"""
     return self.ready \
         and not self._errors \
         and not self._source_has_changed \
         and is_software_selection_complete(
             dnf_manager=self._dnf_manager,
             selection=self._selection,
             kickstarted=self._kickstarted
         )
示例#2
0
    def test_is_software_selection_complete(self):
        """Test the is_software_selection_complete function."""
        selection = PackagesSelectionData()
        selection.environment = "e1"

        dnf_manager = Mock(spec=DNFManager)
        dnf_manager.is_environment_valid.return_value = True

        assert is_software_selection_complete(dnf_manager, selection)
        assert is_software_selection_complete(dnf_manager,
                                              selection,
                                              kickstarted=True)

        dnf_manager.is_environment_valid.return_value = False

        assert not is_software_selection_complete(dnf_manager, selection)
        assert not is_software_selection_complete(
            dnf_manager, selection, kickstarted=True)

        selection.environment = ""

        assert not is_software_selection_complete(dnf_manager, selection)
        assert is_software_selection_complete(dnf_manager,
                                              selection,
                                              kickstarted=True)
示例#3
0
    def is_software_selection_complete_test(self):
        """Test the is_software_selection_complete function."""
        selection = PackagesSelectionData()
        selection.environment = "e1"

        dnf_manager = Mock(spec=DNFManager)
        dnf_manager.is_environment_valid.return_value = True

        self.assertTrue(is_software_selection_complete(dnf_manager, selection))
        self.assertTrue(
            is_software_selection_complete(dnf_manager,
                                           selection,
                                           kickstarted=True))

        dnf_manager.is_environment_valid.return_value = False

        self.assertFalse(is_software_selection_complete(
            dnf_manager, selection))
        self.assertFalse(
            is_software_selection_complete(dnf_manager,
                                           selection,
                                           kickstarted=True))

        selection.environment = ""

        self.assertFalse(is_software_selection_complete(
            dnf_manager, selection))
        self.assertTrue(
            is_software_selection_complete(dnf_manager,
                                           selection,
                                           kickstarted=True))