#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . glance : ( 'image_list_detailed' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_snapshot_actions( self ) : #NEWLINE# #INDENT# snapshots = self . snapshots . list ( ) #NEWLINE# api . glance . image_list_detailed ( IsA ( http . HttpRequest ) , marker = None ) . AndReturn ( [ snapshots , 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' , res . context ) #NEWLINE# snaps = snapshots . context [ 'images_table' ] #NEWLINE# self . assertEqual ( len ( snaps . get_rows ( ) ) , 3 ) #NEWLINE# row_actions = snaps . get_row_actions ( snaps . data [ 0 ] ) #NEWLINE# self . assertEqual ( len ( row_actions ) , 4 ) #NEWLINE# self . assertEqual ( row_actions [ 0 ] . verbose_name , 'Launch' ) #NEWLINE# self . assertEqual ( row_actions [ 1 ] . verbose_name , 'Create Volume' ) #NEWLINE# self . assertEqual ( row_actions [ 2 ] . verbose_name , 'Edit' ) #NEWLINE# self . assertEqual ( row_actions [ 3 ] . verbose_name , 'Delete Image' ) #NEWLINE# row_actions = snaps . get_row_actions ( snaps . data [ 1 ] ) #NEWLINE# self . assertEqual ( len ( row_actions ) , 2 ) #NEWLINE# self . assertEqual ( row_actions [ 0 ] . verbose_name , 'Launch' ) #NEWLINE# self . assertEqual ( row_actions [ 1 ] . verbose_name , 'Create Volume' ) #NEWLINE# row_actions = snaps . get_row_actions ( snaps . data [ 2 ] ) #NEWLINE# self . assertEqual ( len ( row_actions ) , 1 ) #NEWLINE# self . assertEqual ( unicode ( row_actions [ 0 ] . verbose_name ) , 'Delete Image' ) #NEWLINE# self . assertEqual ( str ( row_actions [ 0 ] ) , '<DeleteImage: delete>' )