<s> """<STR_LIT>""" <EOL> import logging <EOL> import sys <EOL> import json <EOL> import time <EOL> import subprocess <EOL> from nose . tools import * <EOL> import voltron <EOL> from voltron . core import * <EOL> from voltron . api import * <EOL> from voltron . plugin import * <EOL> import platform <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> sys . path . append ( "<STR_LIT>" ) <EOL> from . common import * <EOL> import requests <EOL> log = logging . getLogger ( '<STR_LIT>' ) <EOL> class APIHostNotSupportedRequest ( APIRequest ) : <EOL> @ server_side <EOL> def dispatch ( self ) : <EOL> return APIDebuggerHostNotSupportedErrorResponse ( ) <EOL> class APIHostNotSupportedPlugin ( APIPlugin ) : <EOL> request = "<STR_LIT>" <EOL> request_class = APIHostNotSupportedRequest <EOL> response_class = APIResponse <EOL> def setup ( ) : <EOL> global server , client , target , pm , adaptor , methods <EOL> log . info ( "<STR_LIT>" ) <EOL> voltron . setup_env ( ) <EOL> voltron . config [ '<STR_LIT>' ] = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : [ "<STR_LIT:127.0.0.1>" , <NUM_LIT> ] <EOL> } <EOL> } <EOL> pm = PluginManager ( ) <EOL> plugin = pm . debugger_plugin_for_host ( '<STR_LIT>' ) <EOL> adaptor = plugin . adaptor_class ( ) <EOL> voltron . debugger = adaptor <EOL> inject_mock ( adaptor ) <EOL> server = Server ( ) <EOL> server . start ( ) <EOL> time . sleep ( <NUM_LIT:2> ) <EOL> def teardown ( ) : <EOL> server . stop ( ) <EOL> time . sleep ( <NUM_LIT:2> ) <EOL> def test_disassemble ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = APIResponse ( data = data ) <EOL> assert res . is_success <EOL> assert res . disassembly == disassemble_response <EOL> def test_command ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = APIResponse ( data = data ) <EOL> assert res . is_success <EOL> assert res . output == command_response <EOL> def test_targets ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = api_response ( '<STR_LIT>' , data = data ) <EOL> assert res . is_success <EOL> assert res . targets == targets_response <EOL> def test_memory ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = api_response ( '<STR_LIT>' , data = data ) <EOL> url = '<STR_LIT>' . format ( res . registers [ '<STR_LIT>' ] ) <EOL> data = requests . get ( url ) . text <EOL> res = api_response ( '<STR_LIT>' , data = data ) <EOL> assert res . is_success <EOL> assert res . memory == memory_response <EOL> def test_registers ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = api_response ( '<STR_LIT>' , data = data ) <EOL> assert res . is_success <EOL> assert res . registers == registers_response <EOL> def test_stack_length_missing ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = APIErrorResponse ( data = data ) <EOL> assert res . is_error <EOL> assert res . message == '<STR_LIT>' <EOL> def test_stack ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = api_response ( '<STR_LIT>' , data = data ) <EOL> assert res . is_success <EOL> assert res . memory == stack_response <EOL> def test_state ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = api_response ( '<STR_LIT:state>' , data = data ) <EOL> assert res . is_success <EOL> assert res . state == state_response <EOL> def test_version ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = api_response ( '<STR_LIT:version>' , data = data ) <EOL> assert res . is_success <EOL> assert res . api_version == <NUM_LIT> <EOL> assert res . host_version == '<STR_LIT>' <EOL> def test_bad_json ( ) : <EOL> data = requests . post ( '<STR_LIT>' , data = '<STR_LIT>' ) . text <EOL> res = APIResponse ( data = data ) <EOL> assert res . is_error <EOL> assert res . code == <NUM_LIT> <EOL> def test_bad_request ( ) : <EOL> data = requests . post ( '<STR_LIT>' , data = '<STR_LIT>' ) . text <EOL> res = APIResponse ( data = data ) <EOL> assert res . is_error <EOL> assert res . code == <NUM_LIT> <EOL> def test_breakpoints ( ) : <EOL> data = requests . get ( '<STR_LIT>' ) . text <EOL> res = api_response ( '<STR_LIT>' , data = data ) <EOL> assert res . is_success <EOL> assert res . breakpoints == breakpoints_response </s>
