示例#1
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)
示例#2
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.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.')
示例#3
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.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.')
示例#4
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.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: ')