Esempio n. 1
0
    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.')
Esempio n. 2
0
class jCliWithoutAuthTestCases(jCliTestCases):
    @defer.inlineCallbacks
    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.SMPPSFactory)
        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.assertRegex(receivedLines[0],
                         ('Welcome to Jasmin %s console' %
                          jasmin.get_release()).encode('ascii'))
        self.assertRegex(
            receivedLines[3],
            ('Type help or \? to list commands\.').encode('ascii'))
        self.assertRegex(receivedLines[9], ('Session ref: ').encode('ascii'))

    def tearDown(self):
        jCliTestCases.tearDown(self)
        self.proto.connectionLost(None)
Esempio n. 3
0
 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)
Esempio n. 4
0
    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: ')
Esempio n. 5
0
 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.')
Esempio n. 6
0
 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: ')
Esempio n. 7
0
class jCliWithAuthTestCases(jCliTestCases):
    @defer.inlineCallbacks
    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.SMPPSFactory)
        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.assertRegex(receivedLines[0][18:].decode('ascii'),
                         r'Authentication required.')