Пример #1
0
    def test_no_messages(self):
        receiver = NotificationReceiver(self.topics, self.hmc, self.userid,
                                        self.password)

        conn = receiver._conn

        # We do not add any STOMP messages

        conn.mock_start()
        msg_items = receive_notifications(receiver)

        assert msg_items == []
Пример #2
0
    def test_no_messages(self):
        """Test function for not receiving any notification."""

        receiver = NotificationReceiver(self.topics, self.hmc, self.userid,
                                        self.password)
        conn = receiver._conn  # pylint: disable=protected-access

        # We do not add any STOMP messages

        conn.mock_start()  # pylint: disable=no-member
        msg_items = receive_notifications(receiver)

        assert msg_items == []
Пример #3
0
    def test_one_message(self):
        receiver = NotificationReceiver(self.topics, self.hmc, self.userid,
                                        self.password)
        conn = receiver._conn

        # Add one STOMP message to be sent
        message_obj = dict(a=1, b=2)
        conn.mock_add_message(self.std_headers, message_obj)

        conn.mock_start()
        msg_items = receive_notifications(receiver)

        assert len(msg_items) == 1

        msg0 = msg_items[0]
        assert msg0[0] == self.std_headers
        assert msg0[1] == message_obj
Пример #4
0
    def test_one_message(self):
        """Test function for receiving one notification."""

        receiver = NotificationReceiver(self.topics, self.hmc, self.userid,
                                        self.password)
        conn = receiver._conn  # pylint: disable=protected-access

        # Add one STOMP message to be sent
        message_obj = dict(a=1, b=2)
        # pylint: disable=no-member
        conn.mock_add_message(self.std_headers, message_obj)

        conn.mock_start()  # pylint: disable=no-member
        msg_items = receive_notifications(receiver)

        assert len(msg_items) == 1

        msg0 = msg_items[0]
        assert msg0[0] == self.std_headers
        assert msg0[1] == message_obj