#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . glance : ( 'image_list_detailed' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_index( self ) : #NEWLINE# #INDENT# images = self . images . list ( ) #NEWLINE# api . glance . image_list_detailed ( IsA ( http . HttpRequest ) , marker = None ) . AndReturn ( [ images , False , False ] ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# res = self . client . get ( INDEX_URL ) #NEWLINE# self . assertTemplateUsed ( res , 'project/images/index.html' ) #NEWLINE# self . assertIn ( 'images_table' , self . context ) #NEWLINE# images_table = res . context [ 'images_table' ] #NEWLINE# images = images_table . data #NEWLINE# self . assertTrue ( len ( images ) , 3 ) #NEWLINE# row_actions = images_table . get_row_actions ( images [ 0 ] ) #NEWLINE# self . assertTrue ( len ( row_actions ) , 3 ) #NEWLINE# row_actions = images_table . get_row_actions ( images [ 1 ] ) #NEWLINE# self . assertTrue ( len ( row_actions ) , 2 ) #NEWLINE# self . assertTrue ( ( 'delete_image' not in [ a . name for a in row_actions ] ) ) #NEWLINE# row_actions = images_table . get_row_actions ( images [ 2 ] ) #NEWLINE# self . assertTrue ( len ( row_actions ) , 3 )