#NEWLINE# def test_simple( self ) : #NEWLINE# #INDENT# project = self . create_project ( ) #NEWLINE# build = self . create_build ( project ) #NEWLINE# job = self . create_job ( build ) #NEWLINE# jobphase = self . create_jobphase ( job ) #NEWLINE# jobstep = self . create_jobstep ( jobphase ) #NEWLINE# path = '/api/0/jobsteps/{0}/logappend/' . format ( jobstep . id . hex ) #NEWLINE# resp = self . client . post ( path , data = { #NEWLINE# #INDENT# 'source' : 'stderr' , #NEWLINE# 'offset' : 0 , #NEWLINE# 'text' : 'hello world!\n' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( resp . status_code == 200 ) , resp . data #NEWLINE# data = self . unserialize ( resp ) #NEWLINE# logsource = LogSource . query . get ( build [ 'source' ] [ 'id' ] ) #NEWLINE# assert ( logsource . name == 'stderr' ) #NEWLINE# assert ( len ( data [ 'chunks' ] ) == 1 ) #NEWLINE# logchunk = LogChunk . query . get ( data [ 'chunks' ] [ 0 ] [ 'id' ] ) #NEWLINE# assert ( logchunk . offset == 0 ) #NEWLINE# assert ( logchunk . size == 13 ) #NEWLINE# resp = self . client . post ( path , data = { #NEWLINE# #INDENT# 'source' : 'stderr' , #NEWLINE# 'offset' : 13 , #NEWLINE# 'text' : 'foo bar?\n' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( resp . status_code == 200 ) , resp . data #NEWLINE# data = self . unserialize ( resp ) #NEWLINE# logsource = LogSource . query . get ( data [ 'source' ] [ 'id' ] ) #NEWLINE# assert ( logsource . name == 'stderr' ) #NEWLINE# assert ( len ( data [ 'chunks' ] ) == 1 ) #NEWLINE# logchunk = LogChunk . query . get ( data [ 'chunks' ] [ 0 ] [ 'id' ] ) #NEWLINE# assert ( logchunk . offset == 13 ) #NEWLINE# assert ( logchunk . size == 9 ) #NEWLINE# resp = self . client . post ( path , data = { #NEWLINE# #INDENT# 'source' : 'stdout' , #NEWLINE# 'offset' : 0 , #NEWLINE# 'text' : 'zoom zoom\n' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( resp . status_code == 200 ) , resp . data #NEWLINE# data = self . unserialize ( resp ) #NEWLINE# logsource = LogSource . query . get ( data [ 'source' ] [ 'id' ] ) #NEWLINE# assert ( logsource . name == 'stdout' ) #NEWLINE# assert ( len ( data [ 'chunks' ] ) == 1 ) #NEWLINE# logchunk = LogChunk . query . get ( data [ 'chunks' ] [ 0 ] [ 'id' ] ) #NEWLINE# assert ( logchunk . offset == 0 ) #NEWLINE# assert ( logchunk . size == 10 )