Exemplo n.º 1
0
 def test_invalid(in_schema):
     """
     GIVEN invalid kwargs
     WHEN _get_kwargs is called with the schema
     THEN MalformedExtensionPropertyError is raised.
     """
     with pytest.raises(exceptions.MalformedExtensionPropertyError):
         model_factory._get_kwargs(schema=in_schema)
Exemplo n.º 2
0
    def test_valid_not_exists():
        """
        GIVEN schema without kwargs
        WHEN _get_kwargs is called with the schema
        THEN empty dictionary is returned.
        """
        kwargs = model_factory._get_kwargs(schema={})

        assert kwargs == {}
Exemplo n.º 3
0
    def test_valid_exists():
        """
        GIVEN schema with kwargs
        WHEN _get_kwargs is called with the schema
        THEN the kwargs are returned.
        """
        in_schema = {"x-kwargs": {"__key__": "value"}}

        kwargs = model_factory._get_kwargs(schema=in_schema)

        assert kwargs == {"__key__": "value"}