Exemplo n.º 1
0
    def test_validate_schema_correct(self, nested_response):
        correct_schema = dedent("""
              type: map
              required: true
              mapping:
                top:
                  type: map
                  required: true
                  mapping:
                    Thing:
                      type: str
                    float:
                      type: float
                    nested:
                      type: any
                an_integer:
                  type: int
                a_string:
                  type: str
                a_bool:
                  type: bool
        """)

        validate_pykwalify(nested_response,
                           yaml.load(correct_schema, Loader=yaml.SafeLoader))
Exemplo n.º 2
0
    def test_validate_schema_incorrect(self, nested_response):
        correct_schema = dedent("""
              type: seq
              required: true
              sequence:
                - type: str
        """)

        with pytest.raises(exceptions.BadSchemaError):
            validate_pykwalify(nested_response, yaml.load(correct_schema))