'Test ControllerMetaclass works inheriting from non base class.'

@ddt.data(('2.0', 'index', http_client.NOT_ACCEPTABLE, 'ControllerParent'), ('2.0', 'show', http_client.NOT_ACCEPTABLE, 'ControllerParent'), ('3.0', 'index', http_client.NOT_FOUND, 'ControllerParent'), ('3.0', 'show', http_client.NOT_FOUND, 'ControllerParent'), ('3.1', 'index', 'parent', 'ControllerParent'), ('3.1', 'show', http_client.NOT_FOUND, 'ControllerParent'), ('3.2', 'index', 'parent', 'ControllerParent'), ('3.2', 'show', http_client.NOT_FOUND, 'ControllerParent'), ('2.0', 'index', http_client.NOT_ACCEPTABLE, 'Controller'), ('2.0', 'show', http_client.NOT_ACCEPTABLE, 'Controller'), ('3.0', 'index', http_client.NOT_FOUND, 'Controller'), ('3.0', 'show', http_client.NOT_FOUND, 'Controller'), ('3.1', 'index', 'single', 'Controller'), ('3.1', 'show', http_client.NOT_FOUND, 'Controller'), ('3.2', 'index', 'single', 'Controller'), ('3.2', 'show', http_client.NOT_FOUND, 'Controller'), ('2.0', 'index', http_client.NOT_ACCEPTABLE, 'ControllerChild'), ('2.0', 'show', http_client.NOT_ACCEPTABLE, 'ControllerChild'), ('3.0', 'index', http_client.NOT_FOUND, 'ControllerChild'), ('3.0', 'show', http_client.NOT_FOUND, 'ControllerChild'), ('3.1', 'index', 'parent', 'ControllerChild'), ('3.1', 'show', http_client.NOT_FOUND, 'ControllerChild'), ('3.2', 'index', 'child    3.2', 'ControllerChild'), ('3.2', 'show', http_client.NOT_FOUND, 'ControllerChild'), ('3.3', 'index', 'child    3.3', 'ControllerChild'), ('3.3', 'show', 'show', 'ControllerChild'), ('3.4', 'index', 'child    3.4', 'ControllerChild'))
@ddt.unpack
def test_versions_inheritance_of_non_base_controller(self, version, call, expected, controller):

    class ControllerParent(wsgi.Controller, ):
        @wsgi.Controller.api_version('3.1')
        def index(self, req):
            return 'parent'
    class Controller(wsgi.Controller, ):
        @wsgi.Controller.api_version('3.1')
        def index(self, req):
            return 'single'
    class ControllerChild(ControllerParent, ):
        @wsgi.Controller.api_version('3.2')
        def index(self, req):
            return 'child    3.2'
        @index.api_version('3.3')
        def index(self, req):
            return 'child    3.3'
        @index.api_version('3.4')
        def index(self, req):
            return 'child    3.4'
        @wsgi.Controller.api_version('3.3')
        def show(self, req, *args, **kwargs):
            return 'show'
    base_dir = ('/tests' if (call == 'index') else '/tests/123')
    req = self.build_request(base_dir=base_dir, header_version=version)
    app = fakes.TestRouter(locals()[controller]())
    response = req.get_response(app)
    resp = encodeutils.safe_decode(response.body, incoming='utf-8')
    if isinstance(expected, six.string_types):
        self.assertEqual(http_client.OK, response.status_int)
        self.assertEqual(expected, resp)
    else:
        self.assertEqual(expected, response.status_int)
