<s> from nova . db . sqlalchemy import models <EOL> from nova . tests . functional . api_sample_tests import test_servers <EOL> TAG = '<STR_LIT>' <EOL> class ServerTagsJsonTest ( test_servers . ServersSampleBase ) : <EOL> extension_name = '<STR_LIT>' <EOL> microversion = '<STR_LIT>' <EOL> scenarios = [ ( '<STR_LIT>' , { '<STR_LIT>' : '<STR_LIT>' } ) ] <EOL> def _get_create_subs ( self ) : <EOL> return { '<STR_LIT>' : TAG } <EOL> def _put_server_tags ( self ) : <EOL> """<STR_LIT>""" <EOL> uuid = self . _post_server ( ) <EOL> subs = self . _get_create_subs ( ) <EOL> response = self . _do_put ( '<STR_LIT>' % uuid , <EOL> '<STR_LIT>' , subs ) <EOL> self . assertEqual ( <NUM_LIT:200> , response . status_code ) <EOL> return uuid <EOL> def test_server_tags_update_all ( self ) : <EOL> self . _put_server_tags ( ) <EOL> def test_server_tags_show ( self ) : <EOL> uuid = self . _put_server_tags ( ) <EOL> response = self . _do_get ( '<STR_LIT>' % ( uuid , TAG ) ) <EOL> self . assertEqual ( <NUM_LIT> , response . status_code ) <EOL> def test_server_tags_show_with_details_information ( self ) : <EOL> uuid = self . _put_server_tags ( ) <EOL> response = self . _do_get ( '<STR_LIT>' % uuid ) <EOL> subs = self . _get_regexes ( ) <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . _verify_response ( '<STR_LIT>' , <EOL> subs , response , <NUM_LIT:200> ) <EOL> def test_server_tags_list_with_details_information ( self ) : <EOL> self . _put_server_tags ( ) <EOL> response = self . _do_get ( '<STR_LIT>' ) <EOL> subs = self . _get_regexes ( ) <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . _verify_response ( '<STR_LIT>' , subs , response , <NUM_LIT:200> ) <EOL> def test_server_tags_index ( self ) : <EOL> uuid = self . _put_server_tags ( ) <EOL> response = self . _do_get ( '<STR_LIT>' % uuid ) <EOL> subs = self . _get_regexes ( ) <EOL> subs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . _verify_response ( '<STR_LIT>' , subs , response , <NUM_LIT:200> ) <EOL> def test_server_tags_update ( self ) : <EOL> uuid = self . _put_server_tags ( ) <EOL> tag = models . Tag ( ) <EOL> tag . resource_id = uuid <EOL> tag . tag = '<STR_LIT>' <EOL> response = self . _do_put ( '<STR_LIT>' % ( uuid , tag . tag ) ) <EOL> self . assertEqual ( <NUM_LIT> , response . status_code ) <EOL> expected_location = "<STR_LIT>" % ( <EOL> self . _get_vers_compute_endpoint ( ) , uuid , tag . tag ) <EOL> self . assertEqual ( expected_location , response . headers [ '<STR_LIT>' ] ) <EOL> def test_server_tags_delete ( self ) : <EOL> uuid = self . _put_server_tags ( ) <EOL> response = self . _do_delete ( '<STR_LIT>' % ( uuid , TAG ) ) <EOL> self . assertEqual ( <NUM_LIT> , response . status_code ) <EOL> self . assertEqual ( '<STR_LIT>' , response . content ) <EOL> def test_server_tags_delete_all ( self ) : <EOL> uuid = self . _put_server_tags ( ) <EOL> response = self . _do_delete ( '<STR_LIT>' % uuid ) <EOL> self . assertEqual ( <NUM_LIT> , response . status_code ) <EOL> self . assertEqual ( '<STR_LIT>' , response . content ) </s>
