<s> '''<STR_LIT>''' <EOL> import unittest <EOL> import shutil <EOL> import re <EOL> from eucaops import Eucaops <EOL> from testcases . cloud_user . images . imageutils import ImageUtils <EOL> class Euca3460 ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . conf = "<STR_LIT>" <EOL> self . imgName = "<STR_LIT>" <EOL> self . tester = Eucaops ( config_file = self . conf , password = "<STR_LIT>" ) <EOL> self . source = "<STR_LIT>" + self . tester . credpath + "<STR_LIT>" <EOL> self . clc1 = self . tester . service_manager . get_enabled_clc ( ) <EOL> self . iu = ImageUtils ( tester = self . tester , config_file = self . conf ) <EOL> self . iu . create_emi_from_url ( "<STR_LIT>" + self . imgName ) <EOL> self . doAuth ( ) <EOL> def doAuth ( self ) : <EOL> self . keypair = self . tester . add_keypair ( ) <EOL> self . group = self . tester . add_group ( ) <EOL> self . tester . authorize_group ( self . group ) <EOL> self . tester . authorize_group ( self . group , port = <NUM_LIT> , protocol = "<STR_LIT>" ) <EOL> self . skey = self . tester . get_secret_key ( ) <EOL> self . akey = self . tester . get_access_key ( ) <EOL> def test_EUCA_3460 ( self ) : <EOL> self . emi = self . tester . get_emi ( location = self . imgName ) <EOL> self . reservation = self . tester . run_instance ( self . emi , type = "<STR_LIT>" , keypair = self . keypair . name , group = self . group , is_reachable = False , timeout = <NUM_LIT> ) <EOL> for instance in self . reservation . instances : <EOL> if instance . state == "<STR_LIT>" : <EOL> self . ip = instance . public_dns_name <EOL> self . instanceid = instance . id <EOL> print "<STR_LIT>" + self . akey <EOL> print "<STR_LIT>" + self . skey <EOL> self . cmd = "<STR_LIT>" + self . instanceid + "<STR_LIT>" + str ( self . keypair ) + "<STR_LIT>" + self . akey + "<STR_LIT>" + self . skey <EOL> self . out = self . clc1 . machine . cmd ( self . source + self . cmd ) <EOL> match = re . search ( r'<STR_LIT>' , self . out [ "<STR_LIT>" ] ) <EOL> if match : <EOL> self . tester . debug ( "<STR_LIT>" + match . group ( ) ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def tearDown ( self ) : <EOL> if self . reservation is not None : <EOL> self . tester . terminate_instances ( self . reservation ) <EOL> self . tester . delete_keypair ( self . keypair ) <EOL> self . tester . local ( "<STR_LIT>" + self . keypair . name + "<STR_LIT>" ) <EOL> shutil . rmtree ( self . tester . credpath ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( "<STR_LIT>" ) </s>
