<s> from django . core . urlresolvers import reverse <EOL> from django import http <EOL> from mox import IsA <EOL> from openstack_dashboard import api <EOL> from openstack_dashboard . test import helpers as test <EOL> INDEX_URL = reverse ( '<STR_LIT>' ) <EOL> DETAILS_URL = reverse ( <EOL> '<STR_LIT>' , args = [ '<STR_LIT:id>' ] ) <EOL> class DataProcessingClusterTests ( test . TestCase ) : <EOL> @ test . create_stubs ( { api . sahara : ( '<STR_LIT>' , ) } ) <EOL> def test_index ( self ) : <EOL> api . sahara . cluster_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . clusters . list ( ) ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( INDEX_URL ) <EOL> self . assertTemplateUsed ( <EOL> res , '<STR_LIT>' ) <EOL> self . assertContains ( res , '<STR_LIT>' ) <EOL> self . assertContains ( res , '<STR_LIT:Name>' ) <EOL> @ test . create_stubs ( { api . sahara : ( '<STR_LIT>' , '<STR_LIT>' ) } ) <EOL> def test_launch_cluster_get_nodata ( self ) : <EOL> api . sahara . cluster_template_list ( IsA ( http . HttpRequest ) ) . AndReturn ( [ ] ) <EOL> api . sahara . image_list ( IsA ( http . HttpRequest ) ) . AndReturn ( [ ] ) <EOL> self . mox . ReplayAll ( ) <EOL> url = reverse ( <EOL> '<STR_LIT>' ) <EOL> res = self . client . get ( "<STR_LIT>" % url ) <EOL> self . assertContains ( res , "<STR_LIT>" ) <EOL> self . assertContains ( res , "<STR_LIT>" ) <EOL> @ test . create_stubs ( { api . sahara : ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_delete ( self ) : <EOL> cluster = self . clusters . first ( ) <EOL> api . sahara . cluster_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . clusters . list ( ) ) <EOL> api . sahara . cluster_delete ( IsA ( http . HttpRequest ) , cluster . id ) <EOL> self . mox . ReplayAll ( ) <EOL> form_data = { '<STR_LIT:action>' : '<STR_LIT>' % cluster . id } <EOL> res = self . client . post ( INDEX_URL , form_data ) <EOL> self . assertNoFormErrors ( res ) <EOL> self . assertRedirectsNoFollow ( res , INDEX_URL ) <EOL> self . assertMessageCount ( success = <NUM_LIT:1> ) </s>
