#NEWLINE# def test_through_field_only_remove( self ) : #NEWLINE# #INDENT# field = self . _get_base_objects_through_field ( ) #NEWLINE# self . assertEqual ( self . licence . base_objects . all ( ) . count ( ) , 2 ) #NEWLINE# ids = [ self . back_office_assets [ 0 ] . pk ] #NEWLINE# with self . assertNumQueries ( 3 ) : #NEWLINE# #INDENT# field . save ( self . licence , { #NEWLINE# #INDENT# 'base_objects' : ',' . join ( map ( str , ids ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# self . assertEqual ( self . licence . base_objects . all ( ) . count ( ) , 1 ) #NEWLINE# self . assertCountEqual ( self . licence . base_objects . values_list ( 'pk' , flat = True ) , ids ) #NEWLINE# self . assertEqual ( self . licence2 . base_objects . all ( ) . count ( ) , 2 )