# Path: k8s/base.py
# LOG = logging.getLogger(__name__)
#     ADDED = "ADDED"
#     MODIFIED = "MODIFIED"
#     DELETED = "DELETED"
# class MetaModel(type):
# class ApiMixIn(object):
# class Model(six.with_metaclass(MetaModel)):
# class WatchEvent(object):
# class LabelSelector(object):
# class Equality(LabelSelector):
# class Inequality(LabelSelector):
# class LabelSetSelector(LabelSelector):
# class In(LabelSetSelector):
# class NotIn(LabelSetSelector):
# class Exists(LabelSelector):
# class SelfModel:
#     def __new__(mcs, cls, bases, attrs):
#     def _build_url(cls, **kwargs):
#     def find(cls, name="", namespace="default", labels=None):
#     def list(cls, namespace="default"):
#     def watch_list(cls, namespace=None):
#     def get(cls, name, namespace="default"):
#     def get_or_create(cls, **kwargs):
#     def delete(cls, name, namespace="default", **kwargs):
#     def delete_list(cls, namespace="default", labels=None, delete_options=None, **kwargs):
#     def save(self):
#     def _label_selector(labels):
#     def __init__(self, new=True, **kwargs):
#     def _validate_fields(self):
#     def as_dict(self):
#     def merge(self, other):
#     def update_from_dict(self, d):
#     def from_dict(cls, d):
#     def __repr__(self):
#     def __eq__(self, other):
# def _api_name(name):
#     def __init__(self, event_json, cls):
#     def __repr__(self):
#     def __init__(self, value=""):
#     def __str__(self):
#     def __str__(self):
#     def __init__(self):
#     def __str__(self):
# 
# Path: k8s/models/common.py
# class DeleteOptions(Model):
#     apiVersion = Field(six.text_type)
#     dryRun = ListField(six.text_type)
#     gracePeriodSeconds = Field(int)
#     kind = Field(six.text_type)
#     preconditions = Field(Preconditions)
#     propagationPolicy = Field(six.text_type)
# 
# class Preconditions(Model):
#     resourceVersion = Field(six.text_type)
#     uid = Field(six.text_type)


import mock
import pytest
from k8s.base import Model, Field, WatchEvent, Equality, Inequality, In, NotIn, Exists
from k8s.models.common import DeleteOptions, Preconditions
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class Example(Model):
    class Meta:
        url_template = '/example'
        watch_list_url = '/watch/example'

    value = Field(int)


class TestWatchEvent(object):
    def test_watch_event_added(self):
        watch_event = WatchEvent({"type": "ADDED", "object": {"value": 42}}, Example)
        assert watch_event.type == WatchEvent.ADDED
        assert watch_event.object == Example(value=42)

    def test_watch_event_modified(self):

# Path: k8s/base.py
# LOG = logging.getLogger(__name__)
#     ADDED = "ADDED"
#     MODIFIED = "MODIFIED"
#     DELETED = "DELETED"
# class MetaModel(type):
# class ApiMixIn(object):
# class Model(six.with_metaclass(MetaModel)):
# class WatchEvent(object):
# class LabelSelector(object):
# class Equality(LabelSelector):
# class Inequality(LabelSelector):
# class LabelSetSelector(LabelSelector):
# class In(LabelSetSelector):
# class NotIn(LabelSetSelector):
# class Exists(LabelSelector):
# class SelfModel:
#     def __new__(mcs, cls, bases, attrs):
#     def _build_url(cls, **kwargs):
#     def find(cls, name="", namespace="default", labels=None):
#     def list(cls, namespace="default"):
#     def watch_list(cls, namespace=None):
#     def get(cls, name, namespace="default"):
#     def get_or_create(cls, **kwargs):
#     def delete(cls, name, namespace="default", **kwargs):
#     def delete_list(cls, namespace="default", labels=None, delete_options=None, **kwargs):
#     def save(self):
#     def _label_selector(labels):
#     def __init__(self, new=True, **kwargs):
#     def _validate_fields(self):
#     def as_dict(self):
#     def merge(self, other):
#     def update_from_dict(self, d):
#     def from_dict(cls, d):
#     def __repr__(self):
#     def __eq__(self, other):
# def _api_name(name):
#     def __init__(self, event_json, cls):
#     def __repr__(self):
#     def __init__(self, value=""):
#     def __str__(self):
#     def __str__(self):
#     def __init__(self):
#     def __str__(self):
# 
# Path: k8s/models/common.py
# class DeleteOptions(Model):
#     apiVersion = Field(six.text_type)
#     dryRun = ListField(six.text_type)
#     gracePeriodSeconds = Field(int)
#     kind = Field(six.text_type)
#     preconditions = Field(Preconditions)
#     propagationPolicy = Field(six.text_type)
# 
# class Preconditions(Model):
#     resourceVersion = Field(six.text_type)
#     uid = Field(six.text_type)


# Path: tests/k8s/test_base.py
import mock
import pytest
from k8s.base import Model, Field, WatchEvent, Equality, Inequality, In, NotIn, Exists
from k8s.models.common import DeleteOptions, Preconditions

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class Example(Model):
    class Meta:
        url_template = '/example'
        watch_list_url = '/watch/example'

    value = Field(int)


class TestWatchEvent(object):
    def test_watch_event_added(self):
        watch_event = WatchEvent({"type": "ADDED", "object": {"value": 42}}, Example)
        assert watch_event.type == WatchEvent.ADDED
        assert watch_event.object == Example(value=42)

    def test_watch_event_modified(self):

        watch_event = WatchEvent({"type": "MODIFIED", "object": {"value": 42}}, Example)