Пример #1
0
    async def test_can_connect(self):
        stomp = StompReader(None,
                            self.loop,
                            heartbeat={
                                "enabled": True,
                                "cx": 1000,
                                "cy": 1000
                            })
        stomp._transport = Mock()

        stomp.connect()
        stomp._transport.write.assert_called_with(
            b"CONNECT\naccept-version:1.1\nheart-beat:1000,1000\n\n\x00")
Пример #2
0
    async def test_can_connect_with_password(self):
        stomp = StompReader(None,
                            self.loop,
                            heartbeat={
                                'enabled': True,
                                'cx': 1000,
                                'cy': 1000
                            },
                            password='******')
        stomp._transport = Mock()

        stomp.connect()
        stomp._transport.write.assert_called_with(
            b'CONNECT\naccept-version:1.1\nheart-beat:1000,1000\npasscode:pass\n\n\x00'
        )  # noqa
Пример #3
0
    async def test_can_connect_with_username(self):
        stomp = StompReader(None,
                            self.loop,
                            heartbeat={
                                'enabled': True,
                                'cx': 1000,
                                'cy': 1000
                            },
                            username='******')
        stomp._transport = Mock()

        stomp.connect()
        stomp._transport.write.assert_called_with(
            b'CONNECT\naccept-version:1.1\nheart-beat:1000,1000\nlogin:pkiefer\n\n\x00'
        )  # noqa
Пример #4
0
    async def test_can_connect_with_login_pass(self):
        stomp = StompReader(
            None,
            self.loop,
            heartbeat={
                "enabled": True,
                "cx": 1000,
                "cy": 1000
            },
            username="******",
            password="******",
        )
        stomp._transport = Mock()

        stomp.connect()
        stomp._transport.write.assert_called_with(
            b"CONNECT\naccept-version:1.1\nheart-beat:1000,1000\nlogin:pkiefer\npasscode:pass\n\n\x00"
        )  # noqa