#NEWLINE# def test_patch_service_keep_environments_ids( self ) : #NEWLINE# #INDENT# '\n        Check if ServiceEnvironment ids are kept after PATCH.\n        ' #NEWLINE# service = self . services [ 0 ] #NEWLINE# environments_ids = [ env . id for env in service . environments . all ( ) ] #NEWLINE# service_env_ids = [ se . id for se in service . serviceenvironment_set . all ( ) ] #NEWLINE# url = reverse ( 'service-detail' , args = ( service . id , ) ) #NEWLINE# data = { #NEWLINE# #INDENT# 'name' : 'test-service-2' , #NEWLINE# 'environments' : environments_ids , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . client . patch ( url , data , format = 'json' ) #NEWLINE# self . assertEqual ( response . status_code , status . HTTP_200_OK ) #NEWLINE# service . refresh_from_db ( ) #NEWLINE# self . assertEqual ( service . name , 'test-service-2' ) #NEWLINE# new_environments_ids = [ env . id for env in service . environments . all ( ) ] #NEWLINE# new_service_env_ids = [ se . id for se in service . serviceenvironment_set . all ( ) ] #NEWLINE# self . assertCountEqual ( environments_ids , new_environments_ids ) #NEWLINE# self . assertCountEqual ( service_env_ids , new_service_env_ids )