def testCommandErrorInstanciation(self): commandError = CommandError(None) commandError.requestInputString = "-c" commandError.parsedParmData[ commandError. COMMAND_ERROR_TYPE_KEY] = commandError.COMMAND_ERROR_TYPE_PARTIAL_REQUEST commandError.parsedParmData[ commandError. COMMAND_ERROR_MSG_KEY] = commandError.CRYPTO_SYMBOL_MISSING_MSG resultData = commandError.execute() self.assertEqual( "ERROR - invalid partial request -c: crypto symbol missing.", resultData.getValue(ResultData.RESULT_KEY_ERROR_MSG))
def setUp(self): requester = Requester() requester.commandCrypto = CommandCrypto(None) requester.commandQuit = CommandQuit(sys) self.commandError = CommandError(None) requester.commandError = self.commandError self.requester = requester
def __init__(self, printer, configMgr, priceRequester): self.configMgr = configMgr self.priceRequester = priceRequester self.crypCompTranslator = CrypCompExchanges() self.processor = Processor(self.configMgr, self.priceRequester, self.crypCompTranslator) self.requester = Requester(self.configMgr) self.commandPrice = CommandPrice(self.processor, self.configMgr) self.commandCrypto = CommandCrypto(self.processor) self.requester.commandPrice = self.commandPrice self.requester.commandCrypto = self.commandCrypto self.commandQuit = CommandQuit(sys) self.requester.commandQuit = self.commandQuit self.commandError = CommandError(None) self.requester.commandError = self.commandError self.printer = printer
def run(self): req = Requester() proc = Processor() pri = Printer() commandCrypto = CommandCrypto(proc) req.commandCrypto = commandCrypto commandQuit = CommandQuit(sys) req.commandQuit = commandQuit commandError = CommandError(None) req.commandError = commandError while True: command = req.request() result = command.execute() if result != '': pri.print(result)
def __init__(self, printer, configMgr): if os.name == 'posix': FILE_PATH = '/sdcard/cryptopricer.ini' else: FILE_PATH = 'c:\\temp\\cryptopricer.ini' self.configMgr = configMgr self.priceRequester = PriceRequester() self.crypCompTranslator = CrypCompExchanges() self.processor = Processor(self.configMgr, self.priceRequester, self.crypCompTranslator) self.requester = Requester(self.configMgr) self.commandPrice = CommandPrice(self.processor, self.configMgr) self.commandCrypto = CommandCrypto(self.processor) self.requester.commandPrice = self.commandPrice self.requester.commandCrypto = self.commandCrypto self.commandQuit = CommandQuit(sys) self.requester.commandQuit = self.commandQuit self.commandError = CommandError(None) self.requester.commandError = self.commandError self.printer = printer
def testCommandErrorInstanciation(self): commandError = CommandError(None) commandError.rawParmData = "invalid user input" commandError.parsedParmData = [commandError.CRYPTO_SYMBOL_MISSING_MSG] self.assertEquals("Error in input invalid user input: crypto symbol missing !", commandError.execute())