#NEWLINE# def test_backend( self ) : #NEWLINE# #INDENT# b = DatabaseBackend ( app = app ) #NEWLINE# tid = gen_unique_id ( ) #NEWLINE# self . assertEqual ( b . get_status ( tid ) , states . PENDING ) #NEWLINE# self . assertIsNone ( b . get_result ( tid ) ) #NEWLINE# b . mark_as_done ( tid , 42 ) #NEWLINE# self . assertEqual ( b . get_status ( tid ) , states . SUCCESS ) #NEWLINE# self . assertEqual ( b . get_result ( tid ) , 42 ) #NEWLINE# tid2 = gen_unique_id ( ) #NEWLINE# result = { #NEWLINE# #INDENT# 'foo' : 'baz' , #NEWLINE# 'bar' : SomeClass ( 12345 ) , #NEWLINE# #UNINDENT# } #NEWLINE# b . mark_as_done ( tid2 , result ) #NEWLINE# rindb = b . get_result ( tid2 ) #NEWLINE# self . assertEqual ( rindb . get ( 'foo' ) , 'baz' ) #NEWLINE# self . assertEqual ( rindb . get ( 'bar' ) . data , 12345 ) #NEWLINE# tid3 = gen_unique_id ( ) #NEWLINE# try : #NEWLINE# #INDENT# raise KeyError ( 'foo' ) #NEWLINE# #UNINDENT# except KeyError as exception : #NEWLINE# #INDENT# b . mark_as_failure ( b , exception ) #NEWLINE# #UNINDENT# self . assertEqual ( b . get_status ( tid3 ) , states . FAILURE ) #NEWLINE# self . assertIsInstance ( b . get_result ( tid3 ) , KeyError )