# Path: functionaltests/cli/v1/behaviors/container_behaviors.py
# class ContainerBehaviors(base_behaviors.BaseBehaviors):
#     def __init__(self):
#     def delete_container(self, container_href):
#     def create_container(self, secret_hrefs=[]):
#     def get_container(self, container_href):
#     def list_containers(self):
#     def delete_all_created_containers(self):
# 
# Path: functionaltests/cli/v1/behaviors/secret_behaviors.py
# class SecretBehaviors(base_behaviors.BaseBehaviors):
#     def __init__(self):
#     def update_secret(self,
#                       secret_href,
#                       payload):
#     def delete_secret(self, secret_href):
#     def store_secret(self, payload=b"Payload for testing", store_argv=[]):
#     def store_secret_file(self, filename="/tmp/storesecret", store_argv=[]):
#     def get_secret(self, secret_href):
#     def get_secret_payload(self, secret_href, raw=False):
#     def get_secret_file(self, secret_href, filename='/tmp/getsecret'):
#     def list_secrets(self):
#     def delete_all_created_secrets(self):
#     def read_secret_test_file(self, filename='/tmp/getsecret'):
#     def write_secret_test_file(self, filename='/tmp/storesecret',
#                                payload="Payload for testing"):


from functionaltests.cli.base import CmdLineTestCase
from functionaltests.cli.v1.behaviors import container_behaviors
from functionaltests.cli.v1.behaviors import secret_behaviors
from testtools import testcase

class ContainerTestCase(CmdLineTestCase):

    def setUp(self):
        super(ContainerTestCase, self).setUp()
        self.secret_behaviors = secret_behaviors.SecretBehaviors()
        self.container_behaviors = container_behaviors.ContainerBehaviors()

    def tearDown(self):
        super(ContainerTestCase, self).tearDown()
        self.secret_behaviors.delete_all_created_secrets()
        self.container_behaviors.delete_all_created_containers()

    @testcase.attr('positive')
    def test_container_create(self):
        secret_href = self.secret_behaviors.store_secret()
        container_href = self.container_behaviors.create_container(
            secret_hrefs=[secret_href])
        self.assertIsNotNone(container_href)

        container = self.container_behaviors.get_container(container_href)
        self.assertEqual(container_href, container['Container href'])

    @testcase.attr('positive')
    def test_container_list(self):
        containers_to_create = 10
        for _ in range(containers_to_create):
            secret_href = self.secret_behaviors.store_secret()
            self.container_behaviors.create_container(
                secret_hrefs=[secret_href])

# Path: functionaltests/cli/v1/behaviors/container_behaviors.py
# class ContainerBehaviors(base_behaviors.BaseBehaviors):
#     def __init__(self):
#     def delete_container(self, container_href):
#     def create_container(self, secret_hrefs=[]):
#     def get_container(self, container_href):
#     def list_containers(self):
#     def delete_all_created_containers(self):
# 
# Path: functionaltests/cli/v1/behaviors/secret_behaviors.py
# class SecretBehaviors(base_behaviors.BaseBehaviors):
#     def __init__(self):
#     def update_secret(self,
#                       secret_href,
#                       payload):
#     def delete_secret(self, secret_href):
#     def store_secret(self, payload=b"Payload for testing", store_argv=[]):
#     def store_secret_file(self, filename="/tmp/storesecret", store_argv=[]):
#     def get_secret(self, secret_href):
#     def get_secret_payload(self, secret_href, raw=False):
#     def get_secret_file(self, secret_href, filename='/tmp/getsecret'):
#     def list_secrets(self):
#     def delete_all_created_secrets(self):
#     def read_secret_test_file(self, filename='/tmp/getsecret'):
#     def write_secret_test_file(self, filename='/tmp/storesecret',
#                                payload="Payload for testing"):


# Path: functionaltests/cli/v1/smoke/test_container.py
from functionaltests.cli.base import CmdLineTestCase
from functionaltests.cli.v1.behaviors import container_behaviors
from functionaltests.cli.v1.behaviors import secret_behaviors
from testtools import testcase


class ContainerTestCase(CmdLineTestCase):

    def setUp(self):
        super(ContainerTestCase, self).setUp()
        self.secret_behaviors = secret_behaviors.SecretBehaviors()
        self.container_behaviors = container_behaviors.ContainerBehaviors()

    def tearDown(self):
        super(ContainerTestCase, self).tearDown()
        self.secret_behaviors.delete_all_created_secrets()
        self.container_behaviors.delete_all_created_containers()

    @testcase.attr('positive')
    def test_container_create(self):
        secret_href = self.secret_behaviors.store_secret()
        container_href = self.container_behaviors.create_container(
            secret_hrefs=[secret_href])
        self.assertIsNotNone(container_href)

        container = self.container_behaviors.get_container(container_href)
        self.assertEqual(container_href, container['Container href'])

    @testcase.attr('positive')
    def test_container_list(self):
        containers_to_create = 10
        for _ in range(containers_to_create):
            secret_href = self.secret_behaviors.store_secret()
            self.container_behaviors.create_container(
                secret_hrefs=[secret_href])

        container_list = self.container_behaviors.list_containers()