示例#1
0
    def test_valid_deployment_status_schema(self):
        # Ensure valid DeploymentStatusSchemas can be generated

        deployment_status_schemas = self.get_valid_deployment_status_schema()

        for name, status_info in deployment_status_schemas.items():
            status_info_to_schema(name, status_info)
示例#2
0
    def test_invalid_status(self):
        # Ensure a DeploymentStatusSchema cannot be initialized with an invalid status

        status_info = {
            "status": "nonexistent status",
            "message": "welcome to nonexistence",
        }
        with pytest.raises(ValidationError):
            status_info_to_schema("deployment name", status_info)
示例#3
0
    def test_extra_fields_invalid_serve_application_status_schema(self):
        # Undefined fields should be forbidden in the schema

        serve_application_status_schema = (
            self.get_valid_serve_application_status_schema())

        # Schema should be createable with valid fields
        serve_application_status_to_schema(serve_application_status_schema)

        # Schema should raise error when a nonspecified field is included
        with pytest.raises(ValidationError):
            statuses = [
                status_info_to_schema(name, status_info) for name, status_info
                in serve_application_status_schema.items()
            ]
            ServeApplicationStatusSchema(statuses=statuses, fake_field=None)