Esempio n. 1
0
    def test_invalid_json_default():
        """
        GIVEN JSON column with default
        WHEN _check_artifacts is called
        THEN FeatureNotImplementedError is raised.
        """
        artifacts = ColArt(
            open_api=OAColArt(type="type 1", default="value 1"),
            extension=ExtColArt(json=True),
        )

        with pytest.raises(exceptions.FeatureNotImplementedError):
            column._check_artifacts(artifacts=artifacts)
    def test_valid(type_, format_, max_length, autoincrement):
        """
        GIVEN valid artifacts
        WHEN _check_artifacts is called
        THEN MalformedSchemaError is not raised.
        """
        artifacts = ColArt(
            open_api=OAColArt(type=type_,
                              format=format_,
                              max_length=max_length),
            extension=ExtColArt(autoincrement=autoincrement),
        )

        column._check_artifacts(artifacts=artifacts)
    def test_invalid(type_, format_, max_length, autoincrement):
        """
        GIVEN type, format, maxLength and autoincrement
        WHEN _check_artifacts is called with the artifacts
        THEN MalformedSchemaError is raised.
        """
        artifacts = ColArt(
            open_api=OAColArt(type=type_,
                              format=format_,
                              max_length=max_length),
            extension=ExtColArt(autoincrement=autoincrement),
        )

        with pytest.raises(exceptions.MalformedSchemaError):
            column._check_artifacts(artifacts=artifacts)