@@ -121,6 +121,37 @@ def test_update_credential(self, mock_post):
121121 mock_post .assert_called_once_with ('/external_stores/update_credentials' , data ,
122122 custom_headers = {'Content-type' : 'application/vnd.simplivity.v1.15+json' })
123123
124+ @mock .patch .object (Connection , "post" )
125+ @mock .patch .object (Connection , "get" )
126+ def test_unregister_external_store_cluster_name (self , mock_get , mock_post ):
127+ cluster_data = {'name' : 'cluster1' , 'id' : '12345' }
128+ mock_post .return_value = None , [{'object_id' : '12345' }]
129+ mock_get .return_value = {clusters .DATA_FIELD : [cluster_data ]}
130+ resource_data = {'name' : 'storeonce_cat1' }
131+
132+ external_store_obj = self .external_stores .get_by_data (resource_data )
133+ external_store_obj .unregister_external_store ('cluster1' )
134+
135+ data = {'name' : 'storeonce_cat1' , 'omnistack_cluster_id' : '12345' }
136+ mock_post .assert_called_once_with ('/external_stores/unregister' , data ,
137+ custom_headers = {'Content-type' : 'application/vnd.simplivity.v1.15+json' })
138+
139+ @mock .patch .object (Connection , "post" )
140+ @mock .patch .object (Connection , "get" )
141+ def test_unregister_external_store_cluster_obj (self , mock_get , mock_post ):
142+ cluster_data = {'name' : 'cluster1' , 'id' : '12345' }
143+ cluster_obj = self .clusters .get_by_data (cluster_data )
144+ mock_post .return_value = None , [{'object_id' : '12345' }]
145+ mock_get .return_value = {clusters .DATA_FIELD : [cluster_data ]}
146+ resource_data = {'name' : 'storeonce_cat1' }
147+
148+ external_store_obj = self .external_stores .get_by_data (resource_data )
149+ external_store_obj .unregister_external_store (cluster_obj )
150+
151+ data = {'name' : 'storeonce_cat1' , 'omnistack_cluster_id' : '12345' }
152+ mock_post .assert_called_once_with ('/external_stores/unregister' , data ,
153+ custom_headers = {'Content-type' : 'application/vnd.simplivity.v1.15+json' })
154+
124155
125156if __name__ == '__main__' :
126157 unittest .main ()
0 commit comments