<s> import unittest <EOL> import os <EOL> import pexpect <EOL> class RoutersploitCompleterTest ( unittest . TestCase ) : <EOL> def __init__ ( self , methodName = '<STR_LIT>' ) : <EOL> super ( RoutersploitCompleterTest , self ) . __init__ ( methodName ) <EOL> self . cli_path = os . path . abspath ( os . path . join ( __file__ , os . pardir , os . pardir , os . pardir , '<STR_LIT>' ) ) <EOL> self . raw_prompt = "<STR_LIT>" <EOL> self . module_prompt = lambda x : "<STR_LIT>" . format ( x ) <EOL> def setUp ( self ) : <EOL> self . rsf = pexpect . spawn ( '<STR_LIT>' . format ( self . cli_path ) ) <EOL> self . rsf . send ( '<STR_LIT:\r\n>' ) <EOL> self . assertPrompt ( self . raw_prompt ) <EOL> def tearDown ( self ) : <EOL> self . rsf . terminate ( force = True ) <EOL> def assertPrompt ( self , * args ) : <EOL> value = '<STR_LIT>' . join ( args ) <EOL> self . rsf . expect_exact ( value , timeout = <NUM_LIT:1> ) <EOL> def set_module ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( self . module_prompt ( '<STR_LIT>' ) ) <EOL> def test_raw_commands_no_module ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( '<STR_LIT>' , self . raw_prompt ) <EOL> def test_complete_use_raw ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( self . raw_prompt , '<STR_LIT>' ) <EOL> def test_complete_use ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' , <EOL> self . raw_prompt , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_use_creds ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . raw_prompt , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_use_creds_2 ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_use_exploits ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . raw_prompt , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_use_exploits_2 ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_use_exploits_3 ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . raw_prompt , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_use_exploits_4 ( self ) : <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_raw_commands_with_module ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' , <EOL> self . module_prompt ( '<STR_LIT>' ) <EOL> ) <EOL> def test_complete_back_raw ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_check_raw ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_run_raw ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_set_raw ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' , <EOL> self . module_prompt ( '<STR_LIT>' ) <EOL> ) <EOL> def test_complete_set_raw_2 ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' , <EOL> ) <EOL> def test_complete_set ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' , <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' , <EOL> ) <EOL> def test_complete_set_2 ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' , <EOL> ) <EOL> def test_complete_show_raw ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' , <EOL> ) <EOL> def test_complete_show ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> '<STR_LIT>' , <EOL> self . module_prompt ( '<STR_LIT>' ) <EOL> ) <EOL> def test_complete_show_info ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_complete_show_options ( self ) : <EOL> self . set_module ( ) <EOL> self . rsf . send ( "<STR_LIT>" ) <EOL> self . assertPrompt ( <EOL> self . module_prompt ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
