#NEWLINE# def test_create_tender_contract_document( self ) : #NEWLINE# #INDENT# response = self . app . post ( '/tenders/{}/contracts/{}/documents' . format ( self . tender_id , self . contract_id ) , upload_files = [ ( 'file' , 'name.doc' , 'content' ) ] ) #NEWLINE# self . assertEqual ( response . status , '201 Created' ) #NEWLINE# self . assertEqual ( response . content_type , 'application/json' ) #NEWLINE# doc_id = response . json [ 'data' ] [ 'id' ] #NEWLINE# self . assertIn ( doc_id , response . headers [ 'Location' ] ) #NEWLINE# self . assertEqual ( 'name.doc' , response . json [ 'data' ] [ 'title' ] ) #NEWLINE# key = response . json [ 'data' ] [ 'url' ] . split ( '?' ) [ ( - 1 ) ] #NEWLINE# response = self . app . post_json ( '/tenders/{}/cancellations' . format ( self . tender_id ) , { #NEWLINE# #INDENT# 'data' : { #NEWLINE# #INDENT# 'reason' : 'cancellation reason' , #NEWLINE# 'status' : 'active' , #NEWLINE# 'cancellationOf' : 'lot' , #NEWLINE# 'relatedLot' : self . initial_lots [ 0 ] [ 'id' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# response = self . app . post ( '/tenders/{}/contracts/{}/documents' . format ( self . tender_id , self . contract_id ) , upload_files = [ ( 'file' , 'name.doc' , 'content' ) ] , status = 403 ) #NEWLINE# self . assertEqual ( response . status , '403 Forbidden' ) #NEWLINE# self . assertEqual ( response . content_type , 'application/json' ) #NEWLINE# self . assertEqual ( response . json [ 'errors' ] [ 0 ] [ 'description' ] , 'Can add document only in active lot status' )