<s> import unittest <EOL> from openprocurement . api . tests . base import BaseTenderWebTest , test_lots , test_bids <EOL> class TenderCancellationResourceTest ( BaseTenderWebTest ) : <EOL> initial_status = '<STR_LIT>' <EOL> initial_bids = test_bids <EOL> def test_create_tender_cancellation_invalid ( self ) : <EOL> response = self . app . post_json ( '<STR_LIT>' , { <EOL> '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> request_path = '<STR_LIT>' . format ( self . tender_id ) <EOL> response = self . app . post ( request_path , '<STR_LIT:data>' , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : <EOL> u"<STR_LIT>" , u'<STR_LIT:location>' : u'<STR_LIT>' , u'<STR_LIT:name>' : u'<STR_LIT:Content-Type>' } <EOL> ] ) <EOL> response = self . app . post ( <EOL> request_path , '<STR_LIT:data>' , content_type = '<STR_LIT:application/json>' , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , <EOL> u'<STR_LIT:location>' : u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT:data>' } <EOL> ] ) <EOL> response = self . app . post_json ( request_path , '<STR_LIT:data>' , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , <EOL> u'<STR_LIT:location>' : u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT:data>' } <EOL> ] ) <EOL> response = self . app . post_json ( <EOL> request_path , { '<STR_LIT>' : { } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , <EOL> u'<STR_LIT:location>' : u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT:data>' } <EOL> ] ) <EOL> response = self . app . post_json ( request_path , { '<STR_LIT:data>' : { } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : [ u'<STR_LIT>' ] , u'<STR_LIT:location>' : u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT>' } , <EOL> ] ) <EOL> response = self . app . post_json ( request_path , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : [ u'<STR_LIT>' ] , u'<STR_LIT:location>' : u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : '<STR_LIT:0>' * <NUM_LIT:32> <EOL> } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : [ u'<STR_LIT>' ] , u'<STR_LIT:location>' : u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> def test_create_tender_cancellation ( self ) : <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> self . assertEqual ( cancellation [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT:id>' , cancellation ) <EOL> self . assertIn ( cancellation [ '<STR_LIT:id>' ] , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:status>' : '<STR_LIT>' } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> self . assertEqual ( cancellation [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( cancellation [ '<STR_LIT:status>' ] , '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT:id>' , cancellation ) <EOL> self . assertIn ( cancellation [ '<STR_LIT:id>' ] , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertNotIn ( "<STR_LIT>" , response . json [ '<STR_LIT:data>' ] ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> def test_patch_tender_cancellation ( self ) : <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , "<STR_LIT>" ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertNotIn ( "<STR_LIT>" , response . json [ '<STR_LIT:data>' ] ) <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id ) , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . patch_json ( '<STR_LIT>' , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , "<STR_LIT>" ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> def test_get_tender_cancellation ( self ) : <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] , cancellation ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> def test_get_tender_cancellations ( self ) : <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ <NUM_LIT:0> ] , cancellation ) <EOL> response = self . app . get ( '<STR_LIT>' , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> class TenderLotCancellationResourceTest ( BaseTenderWebTest ) : <EOL> initial_status = '<STR_LIT>' <EOL> initial_lots = test_lots <EOL> initial_bids = test_bids <EOL> def test_create_tender_cancellation ( self ) : <EOL> lot_id = self . initial_lots [ <NUM_LIT:0> ] [ '<STR_LIT:id>' ] <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : lot_id <EOL> } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> self . assertEqual ( cancellation [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT:id>' , cancellation ) <EOL> self . assertIn ( cancellation [ '<STR_LIT:id>' ] , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : lot_id <EOL> } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> self . assertEqual ( cancellation [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( cancellation [ '<STR_LIT:status>' ] , '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT:id>' , cancellation ) <EOL> self . assertIn ( cancellation [ '<STR_LIT:id>' ] , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> def test_patch_tender_cancellation ( self ) : <EOL> lot_id = self . initial_lots [ <NUM_LIT:0> ] [ '<STR_LIT:id>' ] <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : lot_id <EOL> } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , "<STR_LIT>" ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , "<STR_LIT>" ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> class TenderLotsCancellationResourceTest ( BaseTenderWebTest ) : <EOL> initial_status = '<STR_LIT>' <EOL> initial_lots = <NUM_LIT:2> * test_lots <EOL> initial_bids = test_bids <EOL> def test_create_tender_cancellation ( self ) : <EOL> lot_id = self . initial_lots [ <NUM_LIT:0> ] [ '<STR_LIT:id>' ] <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : lot_id <EOL> } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> self . assertEqual ( cancellation [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT:id>' , cancellation ) <EOL> self . assertIn ( cancellation [ '<STR_LIT:id>' ] , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : lot_id <EOL> } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> self . assertEqual ( cancellation [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( cancellation [ '<STR_LIT:status>' ] , '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT:id>' , cancellation ) <EOL> self . assertIn ( cancellation [ '<STR_LIT:id>' ] , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertNotEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : lot_id <EOL> } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> def test_patch_tender_cancellation ( self ) : <EOL> lot_id = self . initial_lots [ <NUM_LIT:0> ] [ '<STR_LIT:id>' ] <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( self . tender_id ) , { '<STR_LIT:data>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : lot_id <EOL> } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , "<STR_LIT>" ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> self . assertNotEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , '<STR_LIT>' ) <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) , { "<STR_LIT:data>" : { "<STR_LIT:status>" : "<STR_LIT>" } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id , cancellation [ '<STR_LIT:id>' ] ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT:status>" ] , "<STR_LIT>" ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:data>' ] [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> class TenderCancellationDocumentResourceTest ( BaseTenderWebTest ) : <EOL> def setUp ( self ) : <EOL> super ( TenderCancellationDocumentResourceTest , self ) . setUp ( ) <EOL> response = self . app . post_json ( '<STR_LIT>' . format ( <EOL> self . tender_id ) , { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } } ) <EOL> cancellation = response . json [ '<STR_LIT:data>' ] <EOL> self . cancellation_id = cancellation [ '<STR_LIT:id>' ] <EOL> def test_not_found ( self ) : <EOL> response = self . app . post ( '<STR_LIT>' , status = <NUM_LIT> , upload_files = [ <EOL> ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . post ( '<STR_LIT>' . format ( self . tender_id ) , status = <NUM_LIT> , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . post ( '<STR_LIT>' . format ( self . tender_id , self . cancellation_id ) , status = <NUM_LIT> , upload_files = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT:file>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id ) , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id , self . cancellation_id ) , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . put ( '<STR_LIT>' , status = <NUM_LIT> , <EOL> upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . put ( '<STR_LIT>' . format ( self . tender_id ) , status = <NUM_LIT> , upload_files = [ <EOL> ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . put ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id ) , status = <NUM_LIT> , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> def test_create_tender_cancellation_document ( self ) : <EOL> response = self . app . post ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id ) , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> doc_id = response . json [ "<STR_LIT:data>" ] [ '<STR_LIT:id>' ] <EOL> self . assertIn ( doc_id , response . headers [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:title>" ] ) <EOL> key = response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:url>" ] . split ( '<STR_LIT:?>' ) [ - <NUM_LIT:1> ] <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id , self . cancellation_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ <NUM_LIT:0> ] [ "<STR_LIT:id>" ] ) <EOL> self . assertEqual ( '<STR_LIT>' , response . json [ "<STR_LIT:data>" ] [ <NUM_LIT:0> ] [ "<STR_LIT:title>" ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( self . tender_id , self . cancellation_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ <NUM_LIT:0> ] [ "<STR_LIT:id>" ] ) <EOL> self . assertEqual ( '<STR_LIT>' , response . json [ "<STR_LIT:data>" ] [ <NUM_LIT:0> ] [ "<STR_LIT:title>" ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id ) , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : u'<STR_LIT:url>' , u'<STR_LIT:name>' : u'<STR_LIT>' } <EOL> ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id , key ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_length , <NUM_LIT:7> ) <EOL> self . assertEqual ( response . body , '<STR_LIT:content>' ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:id>" ] ) <EOL> self . assertEqual ( '<STR_LIT>' , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:title>" ] ) <EOL> self . set_status ( '<STR_LIT>' ) <EOL> response = self . app . post ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id ) , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> def test_put_tender_cancellation_document ( self ) : <EOL> response = self . app . post ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id ) , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> doc_id = response . json [ "<STR_LIT:data>" ] [ '<STR_LIT:id>' ] <EOL> self . assertIn ( doc_id , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . put ( '<STR_LIT>' . format ( self . tender_id , self . cancellation_id , doc_id ) , <EOL> status = <NUM_LIT> , <EOL> upload_files = [ ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT:status>' ] , '<STR_LIT:error>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] , [ <EOL> { u'<STR_LIT:description>' : u'<STR_LIT>' , u'<STR_LIT:location>' : <EOL> u'<STR_LIT:body>' , u'<STR_LIT:name>' : u'<STR_LIT:file>' } <EOL> ] ) <EOL> response = self . app . put ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id ) , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:id>" ] ) <EOL> key = response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:url>" ] . split ( '<STR_LIT:?>' ) [ - <NUM_LIT:1> ] <EOL> response = self . app . get ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id , key ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_length , <NUM_LIT:8> ) <EOL> self . assertEqual ( response . body , '<STR_LIT>' ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:id>" ] ) <EOL> self . assertEqual ( '<STR_LIT>' , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:title>" ] ) <EOL> response = self . app . put ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id ) , '<STR_LIT>' , content_type = '<STR_LIT>' ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:id>" ] ) <EOL> key = response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:url>" ] . split ( '<STR_LIT:?>' ) [ - <NUM_LIT:1> ] <EOL> response = self . app . get ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id , key ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_length , <NUM_LIT:8> ) <EOL> self . assertEqual ( response . body , '<STR_LIT>' ) <EOL> self . set_status ( '<STR_LIT>' ) <EOL> response = self . app . put ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id ) , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT>' ) ] , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> def test_patch_tender_cancellation_document ( self ) : <EOL> response = self . app . post ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id ) , upload_files = [ ( '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT:content>' ) ] ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> doc_id = response . json [ "<STR_LIT:data>" ] [ '<STR_LIT:id>' ] <EOL> self . assertIn ( doc_id , response . headers [ '<STR_LIT>' ] ) <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , self . cancellation_id , doc_id ) , { "<STR_LIT:data>" : { "<STR_LIT:description>" : "<STR_LIT>" } } ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:id>" ] ) <EOL> response = self . app . get ( '<STR_LIT>' . format ( <EOL> self . tender_id , self . cancellation_id , doc_id ) ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( doc_id , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:id>" ] ) <EOL> self . assertEqual ( '<STR_LIT>' , response . json [ "<STR_LIT:data>" ] [ "<STR_LIT:description>" ] ) <EOL> self . set_status ( '<STR_LIT>' ) <EOL> response = self . app . patch_json ( '<STR_LIT>' . format ( self . tender_id , self . cancellation_id , doc_id ) , { "<STR_LIT:data>" : { "<STR_LIT:description>" : "<STR_LIT>" } } , status = <NUM_LIT> ) <EOL> self . assertEqual ( response . status , '<STR_LIT>' ) <EOL> self . assertEqual ( response . content_type , '<STR_LIT:application/json>' ) <EOL> self . assertEqual ( response . json [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] , "<STR_LIT>" ) <EOL> def suite ( ) : <EOL> suite = unittest . TestSuite ( ) <EOL> suite . addTest ( unittest . makeSuite ( TenderCancellationDocumentResourceTest ) ) <EOL> suite . addTest ( unittest . makeSuite ( TenderCancellationResourceTest ) ) <EOL> return suite <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( defaultTest = '<STR_LIT>' ) </s>
