def AuthCASHandler(application, authority):
    assert authority.endswith("/") and authority.startswith("http")
    def cas_application(environ, start_response):
        username = environ.get('REMOTE_USER','')
        if username:
            return application(environ, start_response)
        qs = environ.get('QUERY_STRING','').split("&")
        if qs and qs[-1].startswith("ticket="):
            # assume a response from the authority
            ticket = qs.pop().split("=", 1)[1]
            environ['QUERY_STRING'] = "&".join(qs)
            service = construct_url(environ)
            args = urlencode(
                    {'service': service,'ticket': ticket})
            requrl = authority + "validate?" + args
            result = urlopen(requrl).read().split("\n")
            if 'yes' == result[0]:
                environ['REMOTE_USER'] = result[1]
                environ['AUTH_TYPE'] = 'cas'
                return application(environ, start_response)
            exce = CASLoginFailure()
        else:
            service = construct_url(environ)
            args = urlencode({'service': service})
            location = authority + "login?" + args
            exce = CASAuthenticate(location)
        return exce.wsgi_application(environ, start_response)
    return cas_application
Test a VxLAN network profile creation with missing sub-type.
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/auth/cas.py/AuthCASHandler--crossover with--dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/ml2/drivers/cisco/n1kv/test_network_profile_service.py/TestN1KVMechDriverNetworkProfiles.test_create_network_profile_overlay_missing_subtype