#NEWLINE# def get( self , build_id ) : #NEWLINE# #INDENT# build = Build . query . get ( build_id ) #NEWLINE# if ( build is None ) : #NEWLINE# #INDENT# return ( '' , 404 ) #NEWLINE# #UNINDENT# args = self . parser . parse_args ( ) #NEWLINE# test_list = TestCase . query . options ( contains_eager ( 'job' ) ) . join ( Job , ( TestCase . job_id == Job . id ) ) . filter ( ( Job . build_id == build . id ) ) #NEWLINE# if args . query : #NEWLINE# #INDENT# test_list = test_list . filter ( func . lower ( TestCase . name ) . contains ( args . query . lower ( ) ) ) #NEWLINE# #UNINDENT# if args . result : #NEWLINE# #INDENT# test_list = test_list . filter ( ( TestCase . result == Result [ args . result ] ) ) #NEWLINE# #UNINDENT# if ( args . sort == 'duration' ) : #NEWLINE# #INDENT# sort_by = TestCase . duration . desc ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . sort == 'name' ) : #NEWLINE# #INDENT# sort_by = TestCase . name . asc ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( args . sort == 'retries' ) : #NEWLINE# #INDENT# sort_by = TestCase . reruns . desc ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# test_list = test_list . order_by ( sort_by ) #NEWLINE# return self . paginate ( test_list , max_per_page = None )