# Path: functionaltests/cli/v1/behaviors/acl_behaviors.py
# class ACLBehaviors(base_behaviors.BaseBehaviors):
#     def __init__(self):
#     def _add_ref_arg(self, argv, entity_ref):
#     def _add_per_acl_args(self, argv, users=[], project_access=None,
#                           operation_type=None, use_short_arg=False):
#     def acl_delete(self, entity_ref):
#     def acl_get(self, entity_ref):
#     def acl_submit(self, entity_ref, users=None,
#                    project_access=None, use_short_arg=False,
#                    operation_type='read'):
#     def acl_add(self, entity_ref, users=None,
#                 project_access=None, use_short_arg=False,
#                 operation_type='read'):
#     def acl_remove(self, entity_ref, users=None,
#                    project_access=None, use_short_arg=False,
#                    operation_type='read'):
#     def delete_all_created_acls(self):
# 
# 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/utils.py
# class BaseTestCase(oslotest.BaseTestCase):
#     def setUp(self):
#     def tearDown(self):
# def construct_new_test_function(original_func, name, build_params):
#     def test_wrapper(func, test_args, test_kwargs):
#         def wrapper(self):
# def process_parameterized_function(name, func_obj, build_data):
# def parameterized_test_case(cls):
# def parameterized_dataset(build_data):
#     def decorator(func):
# def create_timestamp_w_tz_and_offset(timezone=None, days=0, hours=0, minutes=0,
#                                      seconds=0):
# def get_limit_and_offset_from_ref(ref):
# def get_tomorrow_timestamp():
# def string_to_datetime(datetimestring, date_formats=None):
# def get_id_from_ref(ref):


from functionaltests.cli.base import CmdLineTestCase
from functionaltests.cli.v1.behaviors import acl_behaviors
from functionaltests.cli.v1.behaviors import container_behaviors
from functionaltests.cli.v1.behaviors import secret_behaviors
from functionaltests import utils
from testtools import testcase
        data = self.acl_behaviors.acl_submit(entity_ref=secret_ref,
                                             users=['u1', 'u2'])
        self.assertIsNotNone(data)

        self.acl_behaviors.acl_delete(entity_ref=secret_ref)

        data = self.acl_behaviors.acl_get(entity_ref=secret_ref)

        self.assertEqual('[]', data['Users'])
        self.assertEqual('True', data['Project Access'])
        self.assertEqual(secret_ref + "/acl", data['Secret ACL Ref'])

        # deleting again should be okay as secret or container always has
        # default ACL settings
        self.acl_behaviors.acl_delete(entity_ref=secret_ref + '////')
        data = self.acl_behaviors.acl_get(entity_ref=secret_ref)

        self.assertEqual('[]', data['Users'])
        self.assertEqual('True', data['Project Access'])

    @testcase.attr('negative')
    def test_acl_entity_ref_input_with_acl_uri(self):
        secret_ref = self.secret_behaviors.store_secret()
        container_ref = self.container_behaviors.create_container(
            secret_hrefs=[secret_ref])

        data = self.acl_behaviors.acl_submit(entity_ref=secret_ref,
                                             users=['u1', 'u2'])
        self.assertIsNotNone(data)


# Path: functionaltests/cli/v1/behaviors/acl_behaviors.py
# class ACLBehaviors(base_behaviors.BaseBehaviors):
#     def __init__(self):
#     def _add_ref_arg(self, argv, entity_ref):
#     def _add_per_acl_args(self, argv, users=[], project_access=None,
#                           operation_type=None, use_short_arg=False):
#     def acl_delete(self, entity_ref):
#     def acl_get(self, entity_ref):
#     def acl_submit(self, entity_ref, users=None,
#                    project_access=None, use_short_arg=False,
#                    operation_type='read'):
#     def acl_add(self, entity_ref, users=None,
#                 project_access=None, use_short_arg=False,
#                 operation_type='read'):
#     def acl_remove(self, entity_ref, users=None,
#                    project_access=None, use_short_arg=False,
#                    operation_type='read'):
#     def delete_all_created_acls(self):
# 
# 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/utils.py
# class BaseTestCase(oslotest.BaseTestCase):
#     def setUp(self):
#     def tearDown(self):
# def construct_new_test_function(original_func, name, build_params):
#     def test_wrapper(func, test_args, test_kwargs):
#         def wrapper(self):
# def process_parameterized_function(name, func_obj, build_data):
# def parameterized_test_case(cls):
# def parameterized_dataset(build_data):
#     def decorator(func):
# def create_timestamp_w_tz_and_offset(timezone=None, days=0, hours=0, minutes=0,
#                                      seconds=0):
# def get_limit_and_offset_from_ref(ref):
# def get_tomorrow_timestamp():
# def string_to_datetime(datetimestring, date_formats=None):
# def get_id_from_ref(ref):


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

        data = self.acl_behaviors.acl_submit(entity_ref=secret_ref,
                                             users=['u1', 'u2'])
        self.assertIsNotNone(data)

        self.acl_behaviors.acl_delete(entity_ref=secret_ref)

        data = self.acl_behaviors.acl_get(entity_ref=secret_ref)

        self.assertEqual('[]', data['Users'])
        self.assertEqual('True', data['Project Access'])
        self.assertEqual(secret_ref + "/acl", data['Secret ACL Ref'])

        # deleting again should be okay as secret or container always has
        # default ACL settings
        self.acl_behaviors.acl_delete(entity_ref=secret_ref + '////')
        data = self.acl_behaviors.acl_get(entity_ref=secret_ref)

        self.assertEqual('[]', data['Users'])
        self.assertEqual('True', data['Project Access'])

    @testcase.attr('negative')
    def test_acl_entity_ref_input_with_acl_uri(self):
        secret_ref = self.secret_behaviors.store_secret()
        container_ref = self.container_behaviors.create_container(
            secret_hrefs=[secret_ref])

        data = self.acl_behaviors.acl_submit(entity_ref=secret_ref,
                                             users=['u1', 'u2'])
        self.assertIsNotNone(data)


        err = self.acl_behaviors.acl_delete(entity_ref=container_ref + '/acl')