# Path: k8s/client.py
# class NotFound(K8sClientException):
#     """The resource was not found, and the operation could not be completed"""
# 
# Path: k8s/models/common.py
# class ObjectMeta(Model):
#     annotations = Field(dict)
#     creationTimestamp = ReadOnlyField(datetime.datetime)
#     deletionGracePeriodSeconds = ReadOnlyField(int)
#     deletionTimestamp = ReadOnlyField(datetime.datetime)
#     finalizers = ListField(six.text_type)
#     generateName = Field(six.text_type)
#     generation = ReadOnlyField(int)
#     labels = Field(dict)
#     name = Field(six.text_type)
#     namespace = Field(six.text_type, "default")
#     ownerReferences = ListField(OwnerReference)
#     resourceVersion = ReadOnlyField(six.text_type)
#     selfLink = ReadOnlyField(six.text_type)
#     uid = ReadOnlyField(six.text_type)
# 
# Path: k8s/models/apiextensions_v1_custom_resource_definition.py
# class CustomResourceConversion(Model):
#     strategy = Field(six.text_type)
#     webhook = Field(WebhookConversion)
# 
# class CustomResourceDefinition(Model):
#     class Meta:
#         url_template = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}"
#         list_url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions"
#         watch_list_url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?watch=true"
# 
#     metadata = Field(ObjectMeta)
#     spec = Field(CustomResourceDefinitionSpec)
#     status = Field(CustomResourceDefinitionStatus)
# 
# class CustomResourceDefinitionNames(Model):
#     categories = ListField(six.text_type)
#     kind = Field(six.text_type)
#     listKind = Field(six.text_type)
#     plural = Field(six.text_type)
#     shortNames = ListField(six.text_type)
#     singular = Field(six.text_type)
# 
# class CustomResourceDefinitionSpec(Model):
#     conversion = Field(CustomResourceConversion)
#     group = Field(six.text_type)
#     names = Field(CustomResourceDefinitionNames)
#     preserveUnknownFields = Field(bool)
#     scope = Field(six.text_type)
#     versions = ListField(CustomResourceDefinitionVersion)
# 
# class CustomResourceDefinitionVersion(Model):
#     additionalPrinterColumns = ListField(CustomResourceColumnDefinition)
#     deprecated = Field(bool)
#     deprecationWarning = Field(six.text_type)
#     name = Field(six.text_type)
#     schema = Field(CustomResourceValidation)
#     served = Field(bool)
#     storage = Field(bool)
#     subresources = Field(CustomResourceSubresources)
# 
# class JSONSchemaProps(Model):
#     ref = Field(six.text_type, name='$ref')
#     schema = Field(six.text_type, name='$schema')
#     additionalItems = Field(SelfModel, alt_type=bool)
#     additionalProperties = Field(SelfModel, alt_type=bool)
#     allOf = ListField(SelfModel)
#     anyOf = ListField(SelfModel)
#     default = JSONField()
#     definitions = Field(dict)
#     dependencies = Field(dict)
#     description = Field(six.text_type)
#     enum = JSONField()
#     example = JSONField()
#     exclusiveMaximum = Field(bool)
#     exclusiveMinimum = Field(bool)
#     externalDocs = Field(ExternalDocumentation)
#     format = Field(six.text_type)
#     id = Field(six.text_type)
#     items = Field(SelfModel, alt_type=list)
#     maxItems = Field(int)
#     maxLength = Field(int)
#     maxProperties = Field(int)
#     maximum = Field(int, alt_type=float)
#     minItems = Field(int)
#     minLength = Field(int)
#     minProperties = Field(int)
#     minimum = Field(int, alt_type=float)
#     multipleOf = Field(int, alt_type=float)
#     _not = Field(SelfModel)
#     nullable = Field(bool)
#     oneOf = ListField(SelfModel)
#     pattern = Field(six.text_type)
#     patternProperties = Field(dict)
#     properties = Field(dict)
#     required = ListField(six.text_type)
#     title = Field(six.text_type)
#     type = Field(six.text_type)
#     uniqueItems = Field(bool)
#     x_kubernetes_embedded_resource = Field(bool, name='x-kubernetes-embedded-resource')
#     x_kubernetes_int_or_string = Field(bool, name='x-kubernetes-int-or-string')
#     x_kubernetes_list_map_keys = ListField(six.text_type, name='x-kubernetes-list-map-keys')
#     x_kubernetes_list_type = Field(six.text_type, name="x-kubernetes-list-type")
#     x_kubernetes_map_type = Field(six.text_type, name='x-kubernetes-map-type')
#     x_kubernetes_preserve_unknown_fields = Field(bool, name="x-kubernetes-preserve-unknown-fields")


import mock
import pytest
from k8s.client import NotFound
from k8s.models.common import ObjectMeta
from k8s.models.apiextensions_v1_custom_resource_definition import (
    CustomResourceConversion, CustomResourceDefinition, CustomResourceDefinitionNames,
    CustomResourceDefinitionSpec, CustomResourceDefinitionVersion, JSONSchemaProps)
            "resourceVersion": "96758807",
            "selfLink": _uri(NAME),
            "uid": "d8f1ba26-b182-11e6-a364-fa163ea2a9c4"
        },
        "spec": {
            "conversion": {"strategy": "None"},
            "group": "example.com",
            "names": {
                "kind": "MyCustomResource",
                "plural": "mycustomresources"
            },
            "scope": "namespaced",
            "versions": [{
                "name": "v1",
                "served": True
            }]
        }
    }
    return mock_response


def _create_default_crd():
    object_meta = ObjectMeta(name=NAME, labels={"test": "true"})
    spec = CustomResourceDefinitionSpec(
        conversion=CustomResourceConversion(strategy="None"),
        group="example.com",
        names=CustomResourceDefinitionNames(kind="MyCustomResource", plural="mycustomresources"),
        scope="Namespaced",
        versions=[CustomResourceDefinitionVersion(name="v42", served=True)]
    )

# Path: k8s/client.py
# class NotFound(K8sClientException):
#     """The resource was not found, and the operation could not be completed"""
# 
# Path: k8s/models/common.py
# class ObjectMeta(Model):
#     annotations = Field(dict)
#     creationTimestamp = ReadOnlyField(datetime.datetime)
#     deletionGracePeriodSeconds = ReadOnlyField(int)
#     deletionTimestamp = ReadOnlyField(datetime.datetime)
#     finalizers = ListField(six.text_type)
#     generateName = Field(six.text_type)
#     generation = ReadOnlyField(int)
#     labels = Field(dict)
#     name = Field(six.text_type)
#     namespace = Field(six.text_type, "default")
#     ownerReferences = ListField(OwnerReference)
#     resourceVersion = ReadOnlyField(six.text_type)
#     selfLink = ReadOnlyField(six.text_type)
#     uid = ReadOnlyField(six.text_type)
# 
# Path: k8s/models/apiextensions_v1_custom_resource_definition.py
# class CustomResourceConversion(Model):
#     strategy = Field(six.text_type)
#     webhook = Field(WebhookConversion)
# 
# class CustomResourceDefinition(Model):
#     class Meta:
#         url_template = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}"
#         list_url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions"
#         watch_list_url = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions?watch=true"
# 
#     metadata = Field(ObjectMeta)
#     spec = Field(CustomResourceDefinitionSpec)
#     status = Field(CustomResourceDefinitionStatus)
# 
# class CustomResourceDefinitionNames(Model):
#     categories = ListField(six.text_type)
#     kind = Field(six.text_type)
#     listKind = Field(six.text_type)
#     plural = Field(six.text_type)
#     shortNames = ListField(six.text_type)
#     singular = Field(six.text_type)
# 
# class CustomResourceDefinitionSpec(Model):
#     conversion = Field(CustomResourceConversion)
#     group = Field(six.text_type)
#     names = Field(CustomResourceDefinitionNames)
#     preserveUnknownFields = Field(bool)
#     scope = Field(six.text_type)
#     versions = ListField(CustomResourceDefinitionVersion)
# 
# class CustomResourceDefinitionVersion(Model):
#     additionalPrinterColumns = ListField(CustomResourceColumnDefinition)
#     deprecated = Field(bool)
#     deprecationWarning = Field(six.text_type)
#     name = Field(six.text_type)
#     schema = Field(CustomResourceValidation)
#     served = Field(bool)
#     storage = Field(bool)
#     subresources = Field(CustomResourceSubresources)
# 
# class JSONSchemaProps(Model):
#     ref = Field(six.text_type, name='$ref')
#     schema = Field(six.text_type, name='$schema')
#     additionalItems = Field(SelfModel, alt_type=bool)
#     additionalProperties = Field(SelfModel, alt_type=bool)
#     allOf = ListField(SelfModel)
#     anyOf = ListField(SelfModel)
#     default = JSONField()
#     definitions = Field(dict)
#     dependencies = Field(dict)
#     description = Field(six.text_type)
#     enum = JSONField()
#     example = JSONField()
#     exclusiveMaximum = Field(bool)
#     exclusiveMinimum = Field(bool)
#     externalDocs = Field(ExternalDocumentation)
#     format = Field(six.text_type)
#     id = Field(six.text_type)
#     items = Field(SelfModel, alt_type=list)
#     maxItems = Field(int)
#     maxLength = Field(int)
#     maxProperties = Field(int)
#     maximum = Field(int, alt_type=float)
#     minItems = Field(int)
#     minLength = Field(int)
#     minProperties = Field(int)
#     minimum = Field(int, alt_type=float)
#     multipleOf = Field(int, alt_type=float)
#     _not = Field(SelfModel)
#     nullable = Field(bool)
#     oneOf = ListField(SelfModel)
#     pattern = Field(six.text_type)
#     patternProperties = Field(dict)
#     properties = Field(dict)
#     required = ListField(six.text_type)
#     title = Field(six.text_type)
#     type = Field(six.text_type)
#     uniqueItems = Field(bool)
#     x_kubernetes_embedded_resource = Field(bool, name='x-kubernetes-embedded-resource')
#     x_kubernetes_int_or_string = Field(bool, name='x-kubernetes-int-or-string')
#     x_kubernetes_list_map_keys = ListField(six.text_type, name='x-kubernetes-list-map-keys')
#     x_kubernetes_list_type = Field(six.text_type, name="x-kubernetes-list-type")
#     x_kubernetes_map_type = Field(six.text_type, name='x-kubernetes-map-type')
#     x_kubernetes_preserve_unknown_fields = Field(bool, name="x-kubernetes-preserve-unknown-fields")


# Path: tests/k8s/test_apiextensions_v1_custom_resource_definition.py
import mock
import pytest
from k8s.client import NotFound
from k8s.models.common import ObjectMeta
from k8s.models.apiextensions_v1_custom_resource_definition import (
    CustomResourceConversion, CustomResourceDefinition, CustomResourceDefinitionNames,
    CustomResourceDefinitionSpec, CustomResourceDefinitionVersion, JSONSchemaProps)

            "resourceVersion": "96758807",
            "selfLink": _uri(NAME),
            "uid": "d8f1ba26-b182-11e6-a364-fa163ea2a9c4"
        },
        "spec": {
            "conversion": {"strategy": "None"},
            "group": "example.com",
            "names": {
                "kind": "MyCustomResource",
                "plural": "mycustomresources"
            },
            "scope": "namespaced",
            "versions": [{
                "name": "v1",
                "served": True
            }]
        }
    }
    return mock_response


def _create_default_crd():
    object_meta = ObjectMeta(name=NAME, labels={"test": "true"})
    spec = CustomResourceDefinitionSpec(
        conversion=CustomResourceConversion(strategy="None"),
        group="example.com",
        names=CustomResourceDefinitionNames(kind="MyCustomResource", plural="mycustomresources"),
        scope="Namespaced",
        versions=[CustomResourceDefinitionVersion(name="v42", served=True)]
    )

    crd = CustomResourceDefinition(metadata=object_meta, spec=spec)