#NEWLINE# def test_put_with_depends_on( self ) : #NEWLINE# #INDENT# 'Testing the PUT review-requests/<id>/draft/ API\n        with depends_on field\n        ' #NEWLINE# review_request = self . create_review_request ( submitter = self . user , publish = True ) #NEWLINE# depends_1 = self . create_review_request ( summary = 'Dependency 1' , publish = True ) #NEWLINE# depends_2 = self . create_review_request ( summary = 'Dependency 2' , publish = True ) #NEWLINE# rsp = self . api_put ( get_review_request_draft_url ( review_request ) , { #NEWLINE# #INDENT# 'depends_on' : ( '%s, %s' % ( depends_1 . pk , depends_2 . pk ) ) , #NEWLINE# #UNINDENT# } , expected_mimetype = review_request_draft_item_mimetype ) #NEWLINE# self . assertEqual ( rsp [ 'stat' ] , 'ok' ) #NEWLINE# depends_on = rsp [ 'draft' ] [ 'depends_on' ] #NEWLINE# self . assertEqual ( len ( depends_on ) , 2 ) #NEWLINE# depends_on . sort ( key = ( lambda x : x [ 'title' ] ) ) #NEWLINE# self . assertEqual ( depends_on [ 0 ] [ 'title' ] , depends_1 . summary ) #NEWLINE# self . assertEqual ( depends_on [ 1 ] [ 'title' ] , depends_2 . summary ) #NEWLINE# draft = ReviewRequestDraft . objects . get ( pk = rsp [ 'draft' ] [ 'id' ] ) #NEWLINE# self . assertEqual ( list ( draft . depends_on . order_by ( 'pk' ) ) , [ depends_1 , depends_2 ] ) #NEWLINE# self . assertEqual ( list ( depends_1 . draft_blocks . all ( ) ) , [ draft ] ) #NEWLINE# self . assertEqual ( list ( depends_2 . draft_blocks . all ( ) ) , [ draft ] )