#!/usr/bin/env python
# -*- coding: utf-8 -*-

#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#

import unittest
from kubernetes import K8sContainer


class K8sContainerTest(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    # ------------------------------------------------------------------------------------- init

    def test_init_no_args(self):
        try:
            c = K8sContainer()
            self.fail("Should not fail.")
        except Exception as err:
            self.assertIsInstance(err, SyntaxError)

    def test_init_name_only(self):
        name = "yomama"
        try:
            K8sContainer(name=name)
            self.fail("Should not fail.")
        except Exception as err:
            self.assertIsInstance(err, SyntaxError)

    def test_init_image_only(self):
        image = "busybox"
        try:
            K8sContainer(image=image)
            self.fail("Should not fail.")
        except Exception as err:
            self.assertIsInstance(err, SyntaxError)

    def test_init_with_name_and_image(self):
        name = "yomama"
        image = "busybox"
        c = K8sContainer(name=name, image=image)
        self.assertIsNotNone(c)
        self.assertIsInstance(c, K8sContainer)
        self.assertEqual(c.model.get_name(), name)
        self.assertEqual(c.model.get_image(), image)


@@ -223,16 +223,59 @@
 ntainer%0A
+from kubernetes.models.v1 import Container%0A
 %0A%0Aclass 
@@ -1493,8 +1493,2204 @@
 image)%0A%0A
+    # ------------------------------------------------------------------------------------- struct%0A%0A    def test_struct_k8scontainer(self):%0A        name = %22yomama%22%0A        image = %22busybox%22%0A        c = K8sContainer(name=name, image=image)%0A        self.assertIsNotNone(c)%0A        self.assertIsInstance(c, K8sContainer)%0A        self.assertIsNotNone(c.model)%0A        self.assertIsInstance(c.model, Container)%0A%0A    def test_struct_container(self):%0A        name = %22yomama%22%0A        image = %22busybox%22%0A        c = K8sContainer(name=name, image=image)%0A        self.assertIsInstance(c.model, Container)%0A        self.assertIsNone(c.model.liveness_probe)%0A        self.assertIsNone(c.model.readiness_probe)%0A        self.assertIsNotNone(c.model.model)%0A%0A    def test_struct_container_model(self):%0A        name = %22yomama%22%0A        image = %22busybox%22%0A        c = K8sContainer(name=name, image=image)%0A        model = c.model.model%0A        self.assertIsInstance(model, dict)%0A        self.assertEqual(7, len(model))%0A        self.assertIn('hostNetwork', model)%0A        self.assertIsInstance(model%5B'hostNetwork'%5D, bool)%0A        self.assertIn('image', model)%0A        self.assertIsInstance(model%5B'image'%5D, str)%0A        self.assertIn('imagePullPolicy', model)%0A        self.assertIsInstance(model%5B'imagePullPolicy'%5D, str)%0A        self.assertIn('name', model)%0A        self.assertIsInstance(model%5B'name'%5D, str)%0A        self.assertEqual(model%5B'name'%5D, name)%0A        self.assertIn('privileged', model)%0A        self.assertIsInstance(model%5B'privileged'%5D, bool)%0A        self.assertIn('resources', model)%0A        self.assertIsInstance(model%5B'resources'%5D, dict)%0A        self.assertEqual(1, len(model%5B'resources'%5D))%0A        self.assertIn('requests', model%5B'resources'%5D)%0A        self.assertIsInstance(model%5B'resources'%5D%5B'requests'%5D, dict)%0A        self.assertEqual(2, len(model%5B'resources'%5D%5B'requests'%5D))%0A        self.assertIn('cpu', model%5B'resources'%5D%5B'requests'%5D)%0A        self.assertIsInstance(model%5B'resources'%5D%5B'requests'%5D%5B'cpu'%5D, str)%0A        self.assertIn('memory', model%5B'resources'%5D%5B'requests'%5D)%0A        self.assertIsInstance(model%5B'resources'%5D%5B'requests'%5D%5B'memory'%5D, str)%0A        self.assertIn('terminationMessagePath', model)%0A

add structure tests