Exemplo n.º 1
0
    def test_async_eqlinks(self):
        c1 = Client('localhost', TEST_SERVER_PORT, timeout=1)
        c1.connect()
        cmd1 = make_pdu('enquire_link', client=c1)
        cmd1.sequence = 1
        c1.send_pdu(cmd1)

        c2 = Client('localhost', TEST_SERVER_PORT, timeout=1)
        c2.connect()
        cmd2 = make_pdu('enquire_link', client=c2)
        cmd2.sequence = 2
        c2.send_pdu(cmd2)

        c3 = Client('localhost', TEST_SERVER_PORT, timeout=1)
        c3.connect()
        cmd3 = make_pdu('enquire_link', client=c3)
        cmd3.sequence = 3
        c3.send_pdu(cmd3)

        # Should not block
        resp3 = c3.read_pdu()
        resp1 = c1.read_pdu()
        resp2 = c2.read_pdu()

        # Should dispatch correctly
        self.assertEqual(resp1.sequence, 1)
        self.assertEqual(resp2.sequence, 2)
        self.assertEqual(resp3.sequence, 3)
Exemplo n.º 2
0
    def test_master_enquire_link(self):
        c = Client('localhost', TEST_SERVER_PORT, timeout=1)
        c.connect()

        elink = make_pdu('enquire_link', client=c)
        elink.sequence = 12
        c.send_pdu(elink)

        resp = c.read_pdu()
        self.assertEqual(elink.sequence, resp.sequence)
Exemplo n.º 3
0
    def test_unix_sock_enquire_link(self):
        # Simple sanity test
        client = Client(unix_sock=self.UNIX_SOCK)
        client.connect()

        elink = make_pdu('enquire_link', client=client)
        elink.sequence = 1
        client.send_pdu(elink)

        elink_resp = client.read_pdu()
        self.assertEqual(elink_resp.sequence, elink.sequence)
Exemplo n.º 4
0
    def test_enquire_link_resp(self):
        client = Client('localhost', TEST_SERVER_PORT, timeout=1)
        client.connect()

        command = make_pdu('enquire_link', client=client)
        client.send_pdu(command)
        resp = client.read_pdu()

        self.assertEqual(resp.command, 'enquire_link_resp')
        self.assertEqual(resp.sequence, command.sequence)

        client.disconnect()
Exemplo n.º 5
0
    def test_nobind_nack(self):
        client = Client('localhost', TEST_SERVER_PORT, timeout=1)
        client.connect()

        cmd = make_pdu('submit_sm',
                       client=client,
                       source_addr_ton=12,
                       source_addr="src",
                       dest_addr_ton=34,
                       destination_addr="dst",
                       short_message=b"Hello world")
        client.send_pdu(cmd)
        resp = client.read_pdu()

        self.assertEqual(resp.command, 'generic_nack')
        self.assertEqual(resp.sequence, cmd.sequence)
        self.assertEqual(resp.status, consts.SMPP_ESME_RINVBNDSTS)