File: test_shortcut.py

package info (click to toggle)
python-openapi-schema-validator 0.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: python: 1,186; makefile: 46
file content (21 lines) | stat: -rw-r--r-- 615 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from unittest import TestCase

from openapi_schema_validator import validate


class ValidateTest(TestCase):
    def test_validate_does_not_mutate_schema_adding_nullable_key(self):
        schema = {
            "type": "object",
            "properties": {
                "email": {"type": "string"},
                "enabled": {
                    "type": "boolean",
                },
            },
            "example": {"enabled": False, "email": "foo@bar.com"},
        }

        validate({"email": "foo@bar.com"}, schema)

        self.assertTrue("nullable" not in schema["properties"]["email"].keys())