# Path: armada/api/controller/test.py
# CONF = cfg.CONF
# class TestReleasesReleaseNameController(api.BaseResource):
# class TestReleasesManifestController(api.BaseResource):
#     def on_get(self, req, resp, release):
#     def _format_validation_response(self, req, resp, result, details):
#     def _validate_documents(self, req, resp, documents):
#     def on_post(self, req, resp):
# 
# Path: armada/common/policies/base.py
# ARMADA = 'armada:%s'
# TILLER = 'tiller:%s'
# RULE_ADMIN_REQUIRED = 'rule:admin_required'
# RULE_ADMIN_OR_TARGET_PROJECT = (
#     'rule:admin_required or project_id:%(target.project.id)s')
# RULE_SERVICE_OR_ADMIN = 'rule:service_or_admin'
# def list_rules():
# 
# Path: armada/exceptions/manifest_exceptions.py
# class ManifestException(base.ArmadaBaseException):
# 
# Path: armada/tests/test_utils.py
# def rand_uuid_hex():
# def rand_name(name='', prefix='armada'):
# def rand_bool():
# def rand_int(min, max):
# def rand_password(length=15):
# def attr(**kwargs):
#     def decorator(f):
# 
# Path: armada/tests/unit/api/base.py
# class BaseControllerTest(test_base.ArmadaTestCase):
#     def setUp(self):


import json
import os
import yaml
import mock
from armada.api.controller import test
from armada.common.policies import base as policy_base
from armada.exceptions import manifest_exceptions
from armada.tests import test_utils
from armada.tests.unit.api import base
        rules = {'armada:test_release': '@'}
        self.policy.set_rules(rules)

        mock_tiller.side_effect = Exception

        resp = self.app.simulate_get('/api/v1.0/test/fake-release')
        self.assertEqual(500, resp.status_code)


class TestReleasesReleaseNameControllerNegativeRbacTest(
        base.BaseControllerTest):

    @test_utils.attr(type=['negative'])
    def test_test_release_insufficient_permissions(self):
        """Tests the GET /api/v1.0/test/{release} endpoint returns 403
        following failed authorization.
        """
        rules = {'armada:test_release': policy_base.RULE_ADMIN_REQUIRED}
        self.policy.set_rules(rules)
        resp = self.app.simulate_get('/api/v1.0/test/test-release')
        self.assertEqual(403, resp.status_code)


class TestReleasesManifestControllerNegativeRbacTest(base.BaseControllerTest):

    @test_utils.attr(type=['negative'])
    def test_tests_manifest_insufficient_permissions(self):
        """Tests the POST /api/v1.0/tests endpoint returns 403 following failed
        authorization.
        """

# Path: armada/api/controller/test.py
# CONF = cfg.CONF
# class TestReleasesReleaseNameController(api.BaseResource):
# class TestReleasesManifestController(api.BaseResource):
#     def on_get(self, req, resp, release):
#     def _format_validation_response(self, req, resp, result, details):
#     def _validate_documents(self, req, resp, documents):
#     def on_post(self, req, resp):
# 
# Path: armada/common/policies/base.py
# ARMADA = 'armada:%s'
# TILLER = 'tiller:%s'
# RULE_ADMIN_REQUIRED = 'rule:admin_required'
# RULE_ADMIN_OR_TARGET_PROJECT = (
#     'rule:admin_required or project_id:%(target.project.id)s')
# RULE_SERVICE_OR_ADMIN = 'rule:service_or_admin'
# def list_rules():
# 
# Path: armada/exceptions/manifest_exceptions.py
# class ManifestException(base.ArmadaBaseException):
# 
# Path: armada/tests/test_utils.py
# def rand_uuid_hex():
# def rand_name(name='', prefix='armada'):
# def rand_bool():
# def rand_int(min, max):
# def rand_password(length=15):
# def attr(**kwargs):
#     def decorator(f):
# 
# Path: armada/tests/unit/api/base.py
# class BaseControllerTest(test_base.ArmadaTestCase):
#     def setUp(self):


# Path: armada/tests/unit/api/test_test_controller.py
import json
import os
import yaml
import mock
from armada.api.controller import test
from armada.common.policies import base as policy_base
from armada.exceptions import manifest_exceptions
from armada.tests import test_utils
from armada.tests.unit.api import base

        rules = {'armada:test_release': '@'}
        self.policy.set_rules(rules)

        mock_tiller.side_effect = Exception

        resp = self.app.simulate_get('/api/v1.0/test/fake-release')
        self.assertEqual(500, resp.status_code)


class TestReleasesReleaseNameControllerNegativeRbacTest(
        base.BaseControllerTest):

    @test_utils.attr(type=['negative'])
    def test_test_release_insufficient_permissions(self):
        """Tests the GET /api/v1.0/test/{release} endpoint returns 403
        following failed authorization.
        """
        rules = {'armada:test_release': policy_base.RULE_ADMIN_REQUIRED}
        self.policy.set_rules(rules)
        resp = self.app.simulate_get('/api/v1.0/test/test-release')
        self.assertEqual(403, resp.status_code)


class TestReleasesManifestControllerNegativeRbacTest(base.BaseControllerTest):

    @test_utils.attr(type=['negative'])
    def test_tests_manifest_insufficient_permissions(self):
        """Tests the POST /api/v1.0/tests endpoint returns 403 following failed
        authorization.
        """

        rules = {'armada:tests_manifest': policy_base.RULE_ADMIN_REQUIRED}