Ejemplo n.º 1
0
    def validate_disable_optional_products(disable_optional_products):
        """Make sure that extra vars are a dictionary with boolean values."""
        disable_optional_products = ScanJob.get_optional_products(
            disable_optional_products)

        if not isinstance(disable_optional_products, dict):
            raise ValidationError(_(messages.SJ_EXTRA_VARS_DICT))
        for key in disable_optional_products:
            if not isinstance(disable_optional_products[key], bool):
                raise ValidationError(_(messages.SJ_EXTRA_VARS_BOOL))
            elif key not in [ScanJob.JBOSS_EAP,
                             ScanJob.JBOSS_BRMS,
                             ScanJob.JBOSS_FUSE]:
                raise ValidationError(_(messages.SJ_EXTRA_VARS_KEY))
        return json.dumps(disable_optional_products)
Ejemplo n.º 2
0
 def test_get_optional_products(self):
     """Test the get_optional_products method when arg is None."""
     disable_optional_products = None
     expected = {}
     content = ScanJob.get_optional_products(disable_optional_products)
     self.assertEqual(content, expected)