<s> import re <EOL> from oslo_config import cfg <EOL> from oslo_serialization import jsonutils <EOL> from nova . tests . functional . api_sample_tests import test_servers <EOL> CONF = cfg . CONF <EOL> CONF . import_opt ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> class ConsoleAuthTokensSampleJsonTests ( test_servers . ServersSampleBase ) : <EOL> ADMIN_API = True <EOL> extension_name = "<STR_LIT>" <EOL> extra_extensions_to_load = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> def _get_flags ( self ) : <EOL> f = super ( ConsoleAuthTokensSampleJsonTests , self ) . _get_flags ( ) <EOL> f [ '<STR_LIT>' ] = CONF . osapi_compute_extension [ : ] <EOL> f [ '<STR_LIT>' ] . append ( <EOL> '<STR_LIT>' ) <EOL> f [ '<STR_LIT>' ] . append ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> return f <EOL> def _get_console_url ( self , data ) : <EOL> return jsonutils . loads ( data ) [ "<STR_LIT>" ] [ "<STR_LIT:url>" ] <EOL> def _get_console_token ( self , uuid ) : <EOL> response = self . _do_post ( '<STR_LIT>' % uuid , <EOL> '<STR_LIT>' , <EOL> { '<STR_LIT:action>' : '<STR_LIT>' } ) <EOL> url = self . _get_console_url ( response . content ) <EOL> return re . match ( '<STR_LIT>' , url ) . groups ( ) [ <NUM_LIT:0> ] <EOL> def test_get_console_connect_info ( self ) : <EOL> self . flags ( enabled = True , group = '<STR_LIT>' ) <EOL> uuid = self . _post_server ( ) <EOL> token = self . _get_console_token ( uuid ) <EOL> response = self . _do_get ( '<STR_LIT>' % token ) <EOL> subs = { } <EOL> subs [ "<STR_LIT>" ] = uuid <EOL> subs [ "<STR_LIT:host>" ] = r"<STR_LIT>" <EOL> subs [ "<STR_LIT:port>" ] = "<STR_LIT>" <EOL> subs [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> self . _verify_response ( '<STR_LIT>' , subs , <EOL> response , <NUM_LIT:200> ) </s>
