def test_parse_invalid_promotezip(self) -> None: """Test parse with invalid promotezip value.""" with pytest.raises(ValidationError): assert not ServerlessOptions.parse_obj( {"promotezip": { "key": "value" }})
def test_parse(self, config: Dict[str, Any]) -> None: """Test parse.""" obj = ServerlessOptions.parse_obj(config) assert obj.args == config.get("args", []) assert obj.extend_serverless_yml == config.get( "extend_serverless_yml", cast(Dict[str, Any], {})) if config.get("promotezip"): assert obj.promotezip else: assert not obj.promotezip assert obj.promotezip.bucketname == config.get( "promotezip", cast(Dict[str, Any], {})).get("bucketname") assert obj.skip_npm_ci == config.get("skip_npm_ci", False)
def test_args(self, args: List[str], expected: List[str]) -> None: """Test args.""" obj = ServerlessOptions.parse_obj({"args": args}) assert obj.args == expected