<s> import mock <EOL> from openstack . cluster . v1 import _proxy <EOL> from openstack . cluster . v1 import action <EOL> from openstack . cluster . v1 import build_info <EOL> from openstack . cluster . v1 import cluster <EOL> from openstack . cluster . v1 import cluster_policy <EOL> from openstack . cluster . v1 import event <EOL> from openstack . cluster . v1 import node <EOL> from openstack . cluster . v1 import policy <EOL> from openstack . cluster . v1 import policy_type <EOL> from openstack . cluster . v1 import profile <EOL> from openstack . cluster . v1 import profile_type <EOL> from openstack . cluster . v1 import receiver <EOL> from openstack import proxy as proxy_base <EOL> from openstack . tests . unit import test_proxy_base <EOL> class TestClusterProxy ( test_proxy_base . TestProxyBase ) : <EOL> def setUp ( self ) : <EOL> super ( TestClusterProxy , self ) . setUp ( ) <EOL> self . proxy = _proxy . Proxy ( self . session ) <EOL> def test_build_info_get ( self ) : <EOL> self . verify_get ( self . proxy . get_build_info , build_info . BuildInfo , <EOL> ignore_value = True ) <EOL> def test_profile_types ( self ) : <EOL> self . verify_list ( self . proxy . profile_types , <EOL> profile_type . ProfileType , <EOL> paginated = False ) <EOL> def test_profile_type_get ( self ) : <EOL> self . verify_get ( self . proxy . get_profile_type , <EOL> profile_type . ProfileType ) <EOL> def test_policy_types ( self ) : <EOL> self . verify_list ( self . proxy . policy_types , policy_type . PolicyType , <EOL> paginated = False ) <EOL> def test_policy_type_get ( self ) : <EOL> self . verify_get ( self . proxy . get_policy_type , policy_type . PolicyType ) <EOL> def test_profile_create ( self ) : <EOL> self . verify_create ( self . proxy . create_profile , profile . Profile ) <EOL> def test_profile_delete ( self ) : <EOL> self . verify_delete ( self . proxy . delete_profile , profile . Profile , False ) <EOL> def test_profile_delete_ignore ( self ) : <EOL> self . verify_delete ( self . proxy . delete_profile , profile . Profile , True ) <EOL> def test_profile_find ( self ) : <EOL> self . verify_find ( self . proxy . find_profile , profile . Profile ) <EOL> def test_profile_get ( self ) : <EOL> self . verify_get ( self . proxy . get_profile , profile . Profile ) <EOL> def test_profiles ( self ) : <EOL> self . verify_list ( self . proxy . profiles , profile . Profile , <EOL> paginated = True , <EOL> method_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } , <EOL> expected_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> def test_profile_update ( self ) : <EOL> self . verify_update ( self . proxy . update_profile , profile . Profile ) <EOL> def test_cluster_create ( self ) : <EOL> self . verify_create ( self . proxy . create_cluster , cluster . Cluster ) <EOL> def test_cluster_delete ( self ) : <EOL> self . verify_delete ( self . proxy . delete_cluster , cluster . Cluster , False ) <EOL> def test_cluster_delete_ignore ( self ) : <EOL> self . verify_delete ( self . proxy . delete_cluster , cluster . Cluster , True ) <EOL> def test_cluster_find ( self ) : <EOL> self . verify_find ( self . proxy . find_cluster , cluster . Cluster ) <EOL> def test_cluster_get ( self ) : <EOL> self . verify_get ( self . proxy . get_cluster , cluster . Cluster ) <EOL> def test_clusters ( self ) : <EOL> self . verify_list ( self . proxy . clusters , cluster . Cluster , <EOL> paginated = True , <EOL> method_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } , <EOL> expected_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> def test_cluster_update ( self ) : <EOL> self . verify_update ( self . proxy . update_cluster , cluster . Cluster ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_add_nodes ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_add_nodes , <EOL> method_args = [ "<STR_LIT>" , [ "<STR_LIT>" ] ] , <EOL> expected_args = [ [ "<STR_LIT>" ] ] ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_add_nodes_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_add_nodes , <EOL> method_args = [ mock_cluster , [ "<STR_LIT>" ] ] , <EOL> expected_args = [ [ "<STR_LIT>" ] ] ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_del_nodes ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_del_nodes , <EOL> method_args = [ "<STR_LIT>" , [ "<STR_LIT>" ] ] , <EOL> expected_args = [ [ "<STR_LIT>" ] ] ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_del_nodes_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_del_nodes , <EOL> method_args = [ mock_cluster , [ "<STR_LIT>" ] ] , <EOL> expected_args = [ [ "<STR_LIT>" ] ] ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_scale_out ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_scale_out , <EOL> method_args = [ "<STR_LIT>" , <NUM_LIT:3> ] , <EOL> expected_args = [ <NUM_LIT:3> ] ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_scale_out_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_scale_out , <EOL> method_args = [ mock_cluster , <NUM_LIT:5> ] , <EOL> expected_args = [ <NUM_LIT:5> ] ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_scale_in ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_scale_in , <EOL> method_args = [ "<STR_LIT>" , <NUM_LIT:3> ] , <EOL> expected_args = [ <NUM_LIT:3> ] ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_scale_in_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_scale_in , <EOL> method_args = [ mock_cluster , <NUM_LIT:5> ] , <EOL> expected_args = [ <NUM_LIT:5> ] ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_resize ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_resize , <EOL> method_args = [ "<STR_LIT>" ] , <EOL> method_kwargs = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> expected_kwargs = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_resize_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_resize , <EOL> method_args = [ mock_cluster ] , <EOL> method_kwargs = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> expected_kwargs = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_attach_policy ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_attach_policy , <EOL> method_args = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> method_kwargs = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , <EOL> expected_args = [ "<STR_LIT>" ] , <EOL> expected_kwargs = { "<STR_LIT>" : "<STR_LIT>" , '<STR_LIT>' : "<STR_LIT>" } ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_attach_policy_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_attach_policy , <EOL> method_args = [ mock_cluster , "<STR_LIT>" ] , <EOL> method_kwargs = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , <EOL> expected_args = [ "<STR_LIT>" ] , <EOL> expected_kwargs = { "<STR_LIT>" : "<STR_LIT>" , '<STR_LIT>' : "<STR_LIT>" } ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_detach_policy ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_detach_policy , <EOL> method_args = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> expected_args = [ "<STR_LIT>" ] ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_detach_policy_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_detach_policy , <EOL> method_args = [ mock_cluster , "<STR_LIT>" ] , <EOL> expected_args = [ "<STR_LIT>" ] ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_update_policy ( self , mock_find ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_find . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_update_policy , <EOL> method_args = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> method_kwargs = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , <EOL> expected_args = [ "<STR_LIT>" ] , <EOL> expected_kwargs = { "<STR_LIT>" : "<STR_LIT>" , '<STR_LIT>' : "<STR_LIT>" } ) <EOL> mock_find . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" , <EOL> ignore_missing = False ) <EOL> def test_cluster_update_policy_with_obj ( self ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . cluster_update_policy , <EOL> method_args = [ mock_cluster , "<STR_LIT>" ] , <EOL> method_kwargs = { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } , <EOL> expected_args = [ "<STR_LIT>" ] , <EOL> expected_kwargs = { "<STR_LIT>" : "<STR_LIT>" , '<STR_LIT>' : "<STR_LIT>" } ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_check ( self , mock_get ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_get . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . check_cluster , <EOL> method_args = [ "<STR_LIT>" ] ) <EOL> mock_get . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_cluster_recover ( self , mock_get ) : <EOL> mock_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> mock_get . return_value = mock_cluster <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . recover_cluster , <EOL> method_args = [ "<STR_LIT>" ] ) <EOL> mock_get . assert_called_once_with ( cluster . Cluster , "<STR_LIT>" ) <EOL> def test_node_create ( self ) : <EOL> self . verify_create ( self . proxy . create_node , node . Node ) <EOL> def test_node_delete ( self ) : <EOL> self . verify_delete ( self . proxy . delete_node , node . Node , False ) <EOL> def test_node_delete_ignore ( self ) : <EOL> self . verify_delete ( self . proxy . delete_node , node . Node , True ) <EOL> def test_node_find ( self ) : <EOL> self . verify_find ( self . proxy . find_node , node . Node ) <EOL> def test_node_get ( self ) : <EOL> self . verify_get ( self . proxy . get_node , node . Node , args = None , <EOL> expected_kwargs = { '<STR_LIT:args>' : None } ) <EOL> def test_node_get_with_args ( self ) : <EOL> self . verify_get ( self . proxy . get_node , node . Node , args = { '<STR_LIT>' : True } , <EOL> method_kwargs = { '<STR_LIT:args>' : { '<STR_LIT>' : True } } , <EOL> expected_kwargs = { '<STR_LIT:args>' : { '<STR_LIT>' : True } } ) <EOL> def test_nodes ( self ) : <EOL> self . verify_list ( self . proxy . nodes , node . Node , <EOL> paginated = True , <EOL> method_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } , <EOL> expected_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> def test_node_update ( self ) : <EOL> self . verify_update ( self . proxy . update_node , node . Node ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_node_check ( self , mock_get ) : <EOL> mock_node = node . Node . from_id ( '<STR_LIT>' ) <EOL> mock_get . return_value = mock_node <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . check_node , <EOL> method_args = [ "<STR_LIT>" ] ) <EOL> mock_get . assert_called_once_with ( node . Node , "<STR_LIT>" ) <EOL> @ mock . patch . object ( proxy_base . BaseProxy , '<STR_LIT>' ) <EOL> def test_node_recover ( self , mock_get ) : <EOL> mock_node = node . Node . from_id ( '<STR_LIT>' ) <EOL> mock_get . return_value = mock_node <EOL> self . _verify ( "<STR_LIT>" , <EOL> self . proxy . recover_node , <EOL> method_args = [ "<STR_LIT>" ] ) <EOL> mock_get . assert_called_once_with ( node . Node , "<STR_LIT>" ) <EOL> def test_policy_create ( self ) : <EOL> self . verify_create ( self . proxy . create_policy , policy . Policy ) <EOL> def test_policy_delete ( self ) : <EOL> self . verify_delete ( self . proxy . delete_policy , policy . Policy , False ) <EOL> def test_policy_delete_ignore ( self ) : <EOL> self . verify_delete ( self . proxy . delete_policy , policy . Policy , True ) <EOL> def test_policy_find ( self ) : <EOL> self . verify_find ( self . proxy . find_policy , policy . Policy ) <EOL> def test_policy_get ( self ) : <EOL> self . verify_get ( self . proxy . get_policy , policy . Policy ) <EOL> def test_policies ( self ) : <EOL> self . verify_list ( self . proxy . policies , policy . Policy , <EOL> paginated = True , <EOL> method_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } , <EOL> expected_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> def test_policy_update ( self ) : <EOL> self . verify_update ( self . proxy . update_policy , policy . Policy ) <EOL> def test_cluster_policies ( self ) : <EOL> self . verify_list ( self . proxy . cluster_policies , <EOL> cluster_policy . ClusterPolicy , <EOL> paginated = False , method_args = [ "<STR_LIT>" ] , <EOL> expected_kwargs = { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" } } ) <EOL> def test_get_cluster_policies ( self ) : <EOL> fake_policy = policy . Policy . from_id ( "<STR_LIT>" ) <EOL> fake_cluster = cluster . Cluster . from_id ( '<STR_LIT>' ) <EOL> self . _verify2 ( '<STR_LIT>' , <EOL> self . proxy . get_cluster_policy , <EOL> method_args = [ fake_policy , "<STR_LIT>" ] , <EOL> expected_args = [ cluster_policy . ClusterPolicy , <EOL> '<STR_LIT>' ] , <EOL> expected_kwargs = { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" } } ) <EOL> self . _verify2 ( '<STR_LIT>' , <EOL> self . proxy . get_cluster_policy , <EOL> method_args = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> expected_args = [ cluster_policy . ClusterPolicy , <EOL> "<STR_LIT>" ] , <EOL> expected_kwargs = { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" } } ) <EOL> self . _verify2 ( '<STR_LIT>' , <EOL> self . proxy . get_cluster_policy , <EOL> method_args = [ "<STR_LIT>" , fake_cluster ] , <EOL> expected_args = [ cluster_policy . ClusterPolicy , <EOL> "<STR_LIT>" ] , <EOL> expected_kwargs = { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" } } ) <EOL> def test_receiver_create ( self ) : <EOL> self . verify_create ( self . proxy . create_receiver , receiver . Receiver ) <EOL> def test_receiver_delete ( self ) : <EOL> self . verify_delete ( self . proxy . delete_receiver , receiver . Receiver , <EOL> False ) <EOL> def test_receiver_delete_ignore ( self ) : <EOL> self . verify_delete ( self . proxy . delete_receiver , receiver . Receiver , True ) <EOL> def test_receiver_find ( self ) : <EOL> self . verify_find ( self . proxy . find_receiver , receiver . Receiver ) <EOL> def test_receiver_get ( self ) : <EOL> self . verify_get ( self . proxy . get_receiver , receiver . Receiver ) <EOL> def test_receivers ( self ) : <EOL> self . verify_list ( self . proxy . receivers , receiver . Receiver , <EOL> paginated = True , <EOL> method_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } , <EOL> expected_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> def test_action_get ( self ) : <EOL> self . verify_get ( self . proxy . get_action , action . Action ) <EOL> def test_actions ( self ) : <EOL> self . verify_list ( self . proxy . actions , action . Action , <EOL> paginated = True , <EOL> method_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } , <EOL> expected_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> def test_event_get ( self ) : <EOL> self . verify_get ( self . proxy . get_event , event . Event ) <EOL> def test_events ( self ) : <EOL> self . verify_list ( self . proxy . events , event . Event , <EOL> paginated = True , <EOL> method_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } , <EOL> expected_kwargs = { '<STR_LIT>' : <NUM_LIT:2> } ) </s>
