#NEWLINE# @ mock . patch ( 'sahara.conductor.API.cluster_get' ) #NEWLINE# def test_verifications_ops( self , get_cluster_mock ) : #NEWLINE# #INDENT# cluster = tu . create_cluster ( 'cluster1' , 'tenant_1' , 'fake' , '0.1' , [ 'ng1' ] , status = 'Active' ) #NEWLINE# get_cluster_mock . return_value = cluster #NEWLINE# self . assertIsNone ( c_val . check_cluster_update ( cluster , { #NEWLINE# #INDENT# 'verification' : { #NEWLINE# #INDENT# 'status' : 'START' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# cluster = tu . create_cluster ( 'cluster1' , 'tenant_1' , 'fake' , '0.1' , [ 'ng1' ] , status = 'Active' , verification = { #NEWLINE# #INDENT# 'status' : 'CHECKING' , #NEWLINE# #UNINDENT# } ) #NEWLINE# get_cluster_mock . return_value = cluster #NEWLINE# with testtools . ExpectedException ( verification_base . CannotVerifyError ) : #NEWLINE# #INDENT# c_val . check_cluster_update ( cluster , { #NEWLINE# #INDENT# 'verification' : { #NEWLINE# #INDENT# 'status' : 'START' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# cluster = tu . create_cluster ( 'cluster1' , 'tenant_1' , 'fake' , '0.1' , [ 'ng1' ] , status = 'Active' , verification = { #NEWLINE# #INDENT# 'status' : 'RED' , #NEWLINE# #UNINDENT# } ) #NEWLINE# get_cluster_mock . return_value = cluster #NEWLINE# self . assertIsNone ( c_val . check_cluster_update ( cluster , { #NEWLINE# #INDENT# 'verification' : { #NEWLINE# #INDENT# 'status' : 'START' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# with testtools . ExpectedException ( verification_base . CannotVerifyError ) : #NEWLINE# #INDENT# c_val . check_cluster_update ( cluster , { #NEWLINE# #INDENT# 'is_public' : True , #NEWLINE# 'verification' : { #NEWLINE# #INDENT# 'status' : 'START' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# cluster = tu . create_cluster ( 'cluster1' , 'tenant_1' , 'fake' , '0.1' , [ 'ng1' ] , is_protected = True , status = 'Active' ) #NEWLINE# get_cluster_mock . return_value = cluster #NEWLINE# self . assertIsNone ( c_val . check_cluster_update ( cluster , { #NEWLINE# #INDENT# 'verification' : { #NEWLINE# #INDENT# 'status' : 'START' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# with testtools . ExpectedException ( ex . UpdateFailedException ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# c_val . check_cluster_update ( cluster . id , { #NEWLINE# #INDENT# 'name' : 'new' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except ex . UpdateFailedException as e : #NEWLINE# #INDENT# self . assert_protected_resource_exception ( e ) #NEWLINE# raise e