<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from salttesting import TestCase , skipIf <EOL> from salttesting . mock import ( <EOL> MagicMock , <EOL> patch , <EOL> NO_MOCK , <EOL> NO_MOCK_REASON <EOL> ) <EOL> from salt . modules import nova <EOL> nova . __grains__ = { } <EOL> nova . __salt__ = { } <EOL> nova . __context__ = { } <EOL> nova . __opts__ = { } <EOL> @ skipIf ( NO_MOCK , NO_MOCK_REASON ) <EOL> class NovaTestCase ( TestCase ) : <EOL> '''<STR_LIT>''' <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_boot ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . boot ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_volume_list ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . volume_list ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_volume_show ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . volume_show ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_volume_create ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . volume_create ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_volume_delete ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . volume_delete ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_volume_detach ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . volume_detach ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_volume_attach ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . volume_attach ( '<STR_LIT:name>' , '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_suspend ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . suspend ( '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_resume ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . resume ( '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_lock ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . lock ( '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_delete ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . delete ( '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_flavor_list ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . flavor_list ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_flavor_create ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . flavor_create ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_flavor_delete ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . flavor_delete ( '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_keypair_list ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . keypair_list ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_keypair_add ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . keypair_add ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_keypair_delete ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . keypair_delete ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_image_list ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . image_list ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_image_meta_set ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . image_meta_set ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_image_meta_delete ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . image_meta_delete ( ) ) <EOL> def test_list_ ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . object ( nova , '<STR_LIT>' , return_value = [ '<STR_LIT:A>' ] ) : <EOL> self . assertEqual ( nova . list_ ( ) , [ '<STR_LIT:A>' ] ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_server_list ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . server_list ( ) ) <EOL> def test_show ( self ) : <EOL> '''<STR_LIT>''' <EOL> with patch . object ( nova , '<STR_LIT>' , return_value = [ '<STR_LIT:A>' ] ) : <EOL> self . assertEqual ( nova . show ( '<STR_LIT>' ) , [ '<STR_LIT:A>' ] ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_server_list_detailed ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . server_list_detailed ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_server_show ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . server_show ( '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_secgroup_create ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . secgroup_create ( '<STR_LIT:name>' , '<STR_LIT>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_secgroup_delete ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . secgroup_delete ( '<STR_LIT:name>' ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_secgroup_list ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . secgroup_list ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_server_by_name ( self , mock_auth ) : <EOL> '''<STR_LIT>''' <EOL> mock_auth . side_effect = MagicMock ( ) <EOL> with patch . object ( mock_auth , <EOL> '<STR_LIT>' , MagicMock ( return_value = '<STR_LIT:A>' ) ) : <EOL> self . assertTrue ( nova . server_by_name ( '<STR_LIT:name>' ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from integration import run_tests <EOL> run_tests ( NovaTestCase , needs_daemon = False ) </s>
