Example #1
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)
Example #2
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
Example #3
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
Example #4
0
 def failed_create_payload_test(self):
     """Test failed create method of the payload factory."""
     with self.assertRaises(ValueError):
         PayloadFactory.create_payload("INVALID")
Example #5
0
 def test_failed_create_payload(self):
     """Test failed create method of the payload factory."""
     with pytest.raises(ValueError):
         PayloadFactory.create_payload("INVALID")