Пример #1
0
 def _check_payload_type(self, payload_type, kickstart):
     """Check the payload type for the given kickstart."""
     specification = PayloadKickstartSpecification
     handler = KickstartSpecificationHandler(specification)
     parser = KickstartSpecificationParser(handler, specification)
     parser.readKickstartFromString(kickstart)
     self.assertEqual(payload_type, PayloadFactory.get_type_for_kickstart(handler))
Пример #2
0
 def create_payload_test(self):
     """Test PayloadFactory create method."""
     for payload_type in PayloadType:
         module = PayloadFactory.create_payload(payload_type)
         self.assertIsInstance(module, PayloadBase)
         self.assertIsInstance(module.for_publication(), PayloadBaseInterface)
         self.assertEqual(module.type, payload_type)
Пример #3
0
 def test_create_payload(self):
     """Test PayloadFactory create method."""
     for payload_type in PayloadType:
         module = PayloadFactory.create_payload(payload_type)
         assert isinstance(module, PayloadBase)
         assert isinstance(module.for_publication(), PayloadBaseInterface)
         assert module.type == payload_type
Пример #4
0
    def process_kickstart(self, data):
        """Process the kickstart data."""
        # Create a new payload module.
        payload_type = PayloadFactory.get_type_for_kickstart(data)

        if payload_type:
            payload_module = self.create_payload(payload_type)
            payload_module.process_kickstart(data)
            self.activate_payload(payload_module)
Пример #5
0
    def create_payload(self, payload_type):
        """Create payload based on the passed type.

        :param payload_type: type of the desirable payload
        :type payload_type: value of the payload.base.constants.PayloadType enum
        """
        payload = PayloadFactory.create_payload(payload_type)
        self._add_created_payload(payload)
        return payload
Пример #6
0
    def process_kickstart(self, data):
        """Process the kickstart data."""
        # Create a new payload module.
        payload_type = PayloadFactory.get_type_for_kickstart(data)

        if payload_type:
            payload_module = self.create_payload(payload_type)
            payload_module.process_kickstart(data)

            # FIXME: This is a temporary workaround.
            PayloadContainer.to_object_path(payload_module)
Пример #7
0
    def process_kickstart(self, data):
        """Process the kickstart data."""
        # Create a new payload module.
        payload_type = PayloadFactory.get_type_for_kickstart(data)

        if payload_type:
            payload_module = self.create_payload(payload_type)
            payload_module.process_kickstart(data)

            # FIXME: This is a temporary workaround.
            PayloadContainer.to_object_path(payload_module)

        # FIXME: Process packages in the DNF module.
        # The packages module should be replaces with a DBus structure.
        self._packages.process_kickstart(data)
Пример #8
0
 def failed_create_payload_test(self):
     """Test failed create method of the payload factory."""
     with self.assertRaises(ValueError):
         PayloadFactory.create_payload("INVALID")
Пример #9
0
 def test_failed_create_payload(self):
     """Test failed create method of the payload factory."""
     with pytest.raises(ValueError):
         PayloadFactory.create_payload("INVALID")