# 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/pod.py
# class ContainerPort(Model):
# class ObjectFieldSelector(Model):
# class ResourceFieldSelector(Model):
# class ConfigMapKeySelector(Model):
# class SecretKeySelector(Model):
# class EnvVarSource(Model):
# class SecretEnvSource(Model):
# class ConfigMapEnvSource(Model):
# class EnvFromSource(Model):
# class EnvVar(Model):
# class ResourceRequirements(Model):
# class VolumeMount(Model):
# class HTTPHeader(Model):
# class HTTPGetAction(Model):
# class TCPSocketAction(Model):
# class ExecAction(Model):
# class Probe(Model):
# class Handler(Model):
# class Lifecycle(Model):
# class Container(Model):
# class SecretVolumeSource(Model):
# class KeyToPath(Model):
# class ConfigMapVolumeSource(Model):
# class EmptyDirVolumeSource(Model):
# class NFSVolumeSource(Model):
# class HostPathVolumeSource(Model):
# class GCEPersistentDiskVolumeSource(Model):
# class AWSElasticBlockStoreVolumeSource(Model):
# class Volume(Model):
# class PodSpec(Model):
# class PodTemplateSpec(Model):
# class Pod(Model):
#     class Meta:


import mock
import pytest
from k8s.client import NotFound
from k8s.models.common import ObjectMeta
from k8s.models.pod import Pod, ContainerPort, Container, LocalObjectReference, PodSpec, Volume, VolumeMount, \
    SecretVolumeSource
        assert pod._new
        pod.save()
        assert not pod._new
        pytest.helpers.assert_any_call(post, POD_URI, call_params)

    def test_get_or_create_pod_not_new(self, put, get):
        mock_response = mock.Mock()
        mock_response.json.return_value = {
            'apiVersion': 'v1',
            'kind': 'Pod',
            'metadata': {
                'creationTimestamp': '2017-10-03T10:36:20Z',
                'labels': {
                    'app': 'my-name', 'test': 'true'
                },
                'name': 'my-name',
                'namespace': 'my-namespace',
                'resourceVersion': '852',
                'selfLink': '/api/v1/namespaces/my-namespace/pods/my-name',
                'uid': 'b1e35ab5-a826-11e7-ba76-0800273598c9'
            },
            'spec': {
                'containers': [{
                    'image': 'dummy_image',
                    'imagePullPolicy': 'IfNotPresent',
                    'name': 'container',
                    'ports': [{
                        'containerPort': 5000,
                        'name': 'http5000',
                        'protocol': 'TCP'

# 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/pod.py
# class ContainerPort(Model):
# class ObjectFieldSelector(Model):
# class ResourceFieldSelector(Model):
# class ConfigMapKeySelector(Model):
# class SecretKeySelector(Model):
# class EnvVarSource(Model):
# class SecretEnvSource(Model):
# class ConfigMapEnvSource(Model):
# class EnvFromSource(Model):
# class EnvVar(Model):
# class ResourceRequirements(Model):
# class VolumeMount(Model):
# class HTTPHeader(Model):
# class HTTPGetAction(Model):
# class TCPSocketAction(Model):
# class ExecAction(Model):
# class Probe(Model):
# class Handler(Model):
# class Lifecycle(Model):
# class Container(Model):
# class SecretVolumeSource(Model):
# class KeyToPath(Model):
# class ConfigMapVolumeSource(Model):
# class EmptyDirVolumeSource(Model):
# class NFSVolumeSource(Model):
# class HostPathVolumeSource(Model):
# class GCEPersistentDiskVolumeSource(Model):
# class AWSElasticBlockStoreVolumeSource(Model):
# class Volume(Model):
# class PodSpec(Model):
# class PodTemplateSpec(Model):
# class Pod(Model):
#     class Meta:


# Path: tests/k8s/test_pod.py
import mock
import pytest
from k8s.client import NotFound
from k8s.models.common import ObjectMeta
from k8s.models.pod import Pod, ContainerPort, Container, LocalObjectReference, PodSpec, Volume, VolumeMount, \
    SecretVolumeSource

        assert pod._new
        pod.save()
        assert not pod._new
        pytest.helpers.assert_any_call(post, POD_URI, call_params)

    def test_get_or_create_pod_not_new(self, put, get):
        mock_response = mock.Mock()
        mock_response.json.return_value = {
            'apiVersion': 'v1',
            'kind': 'Pod',
            'metadata': {
                'creationTimestamp': '2017-10-03T10:36:20Z',
                'labels': {
                    'app': 'my-name', 'test': 'true'
                },
                'name': 'my-name',
                'namespace': 'my-namespace',
                'resourceVersion': '852',
                'selfLink': '/api/v1/namespaces/my-namespace/pods/my-name',
                'uid': 'b1e35ab5-a826-11e7-ba76-0800273598c9'
            },
            'spec': {
                'containers': [{
                    'image': 'dummy_image',
                    'imagePullPolicy': 'IfNotPresent',
                    'name': 'container',
                    'ports': [{
                        'containerPort': 5000,
                        'name': 'http5000',
                        'protocol': 'TCP'

                    }],