def startJCliService(self): "Start jCli console server" loadConfigProfileWithCreds = {'username': self.options['username'], 'password': self.options['password']} JCliConfigInstance = JCliConfig(self.options['config']) JCli_f = JCliFactory(JCliConfigInstance, self.components['smppcm-pb-factory'], self.components['router-pb-factory'], loadConfigProfileWithCreds) self.components['jcli-server'] = reactor.listenTCP(JCliConfigInstance.port, JCli_f, interface=JCliConfigInstance.bind)
def setUp(self): yield jCliTestCases.setUp(self) # Connect to jCli server through a fake network transport self.JCliConfigInstance = JCliConfig() self.JCli_f = JCliFactory(self.JCliConfigInstance, self.clientManager_f, self.RouterPB_f) self.proto = self.JCli_f.buildProtocol(('127.0.0.1', 0)) self.tr = proto_helpers.StringTransport() self.proto.makeConnection(self.tr) # Test for greeting receivedLines = self.getBuffer(True) self.assertRegexpMatches(receivedLines[0], r'Authentication required.')
def setUp(self): yield jCliTestCases.setUp(self) # Connect to jCli server through a fake network transport self.JCliConfigInstance = JCliConfig() self.JCliConfigInstance.authentication = False self.JCli_f = JCliFactory(self.JCliConfigInstance, self.clientManager_f, self.RouterPB_f) self.proto = self.JCli_f.buildProtocol(('127.0.0.1', 0)) self.tr = proto_helpers.StringTransport() self.proto.makeConnection(self.tr) # Test for greeting receivedLines = self.getBuffer(True) self.assertRegexpMatches(receivedLines[0], r'Welcome to Jasmin console') self.assertRegexpMatches(receivedLines[3], r'Type help or \? to list commands\.') self.assertRegexpMatches(receivedLines[9], r'Session ref: ')