def test_default_schema_definition(schema_template):
        validator = schema_validator.SchemaValidator(
            None, util_classes.PLUGIN_SCHEMA,
            util_classes.ValidationMode.ERROR, schema_template)
        validator.validate()

        # Validate the repository schema only has the 'name' property.
        assert len(schema_template['repositoryDefinition']
                   ['properties']) == 1, json.dumps(
                       schema_template['repositoryDefinition'])
        assert 'name' in schema_template['repositoryDefinition']['properties']
        assert schema_template['repositoryDefinition']['nameField'] == 'name'
        assert schema_template['repositoryDefinition']['identityFields'] == [
            'name'
        ]

        # Validate the source config schema only has the 'name' property.
        assert len(schema_template['sourceConfigDefinition']
                   ['properties']) == 1, json.dumps(
                       schema_template['sourceConfigDefinition'])
        assert 'name' in schema_template['sourceConfigDefinition'][
            'properties']
        assert schema_template['sourceConfigDefinition']['nameField'] == 'name'
        assert schema_template['sourceConfigDefinition']['identityFields'] == [
            'name'
        ]

        #
        # Validate the linked source, virtual source, and snapshot definitions
        # have no properties.
        #
        assert schema_template['linkedSourceDefinition']['properties'] == {}
        assert schema_template['virtualSourceDefinition']['properties'] == {}
        assert schema_template['snapshotDefinition']['properties'] == {}
Beispiel #2
0
    def test_default_schema_definition(schema_template):
        validator = schema_validator.SchemaValidator(
            None,
            util_classes.PLUGIN_SCHEMA,
            util_classes.ValidationMode.ERROR,
            schema_template,
        )
        validator.validate()

        # Validate the repository schema only has the 'name' property.
        assert (len(schema_template["repositoryDefinition"]["properties"]) == 1
                ), json.dumps(schema_template["repositoryDefinition"])
        assert "name" in schema_template["repositoryDefinition"]["properties"]
        assert schema_template["repositoryDefinition"]["nameField"] == "name"
        assert schema_template["repositoryDefinition"]["identityFields"] == [
            "name"
        ]

        # Validate the source config schema only has the 'name' property.
        assert (len(
            schema_template["sourceConfigDefinition"]["properties"]) == 1
                ), json.dumps(schema_template["sourceConfigDefinition"])
        assert "name" in schema_template["sourceConfigDefinition"][
            "properties"]
        assert schema_template["sourceConfigDefinition"]["nameField"] == "name"
        assert schema_template["sourceConfigDefinition"]["identityFields"] == [
            "name"
        ]

        #
        # Validate the linked source, virtual source, and snapshot definitions
        # have no properties.
        #
        assert schema_template["linkedSourceDefinition"]["properties"] == {}
        assert schema_template["virtualSourceDefinition"]["properties"] == {}
        assert schema_template["snapshotDefinition"]["properties"] == {}