<s> """<STR_LIT>""" <EOL> from cafe . drivers . unittest . decorators import tags <EOL> from cloudcafe . compute . common . exceptions import Forbidden , ItemNotFound , BadRequest <EOL> from cloudroast . compute . fixtures import ComputeFixture <EOL> class AdminAuthorizationTest ( ComputeFixture ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> super ( AdminAuthorizationTest , cls ) . setUpClass ( ) <EOL> cls . server = cls . server_behaviors . create_active_server ( ) . entity <EOL> cls . resources . add ( cls . server . id , cls . servers_client . delete_server ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_lock_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . lock_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_unlock_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . unlock_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_migrate_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . migrate_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_live_migrate_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . live_migrate_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_stop_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( BadRequest ) : <EOL> self . servers_client . stop_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_start_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( BadRequest ) : <EOL> self . servers_client . start_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_suspend_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . suspend_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_resume_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . resume_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_pause_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . pause_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_unpause_server_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . unpause_server ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_reset_server_state_fails_as_user ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . servers_client . reset_state ( self . server . id ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_create_flavor_fails_as_user ( self ) : <EOL> with self . assertRaises ( ItemNotFound ) : <EOL> self . flavors_client . create_flavor ( <EOL> name = '<STR_LIT>' , ram = '<STR_LIT>' , vcpus = '<STR_LIT:1>' , disk = '<STR_LIT>' , id = '<STR_LIT:100>' , <EOL> is_public = True ) <EOL> @ tags ( type = '<STR_LIT>' , net = '<STR_LIT>' ) <EOL> def test_delete_flavor_fails_as_user ( self ) : <EOL> with self . assertRaises ( ItemNotFound ) : <EOL> self . flavors_client . delete_flavor ( self . flavor_ref ) </s>
