예제 #1
0
파일: script.py 프로젝트: zzmjohn/tribler
    def test_outgoing_channel(self):
        """
        We will send a 'channel' message from SELF to NODE.
        """
        community = ChannelCommunity.create_community(self._my_member)
        address = self._dispersy.socket.get_address()

        # create node and ensure that SELF knows the node address
        node = ChannelNode(community)
        node.init_socket()
        node.init_my_member()
        yield 0.1

        # send a 'channel' message
        community.create_channel(u"initial channel name",
                                 u"initial channel description")
        yield 0.1

        _, message = node.receive_message(addresses=[address],
                                          message_names=[u"channel"])
        assert message.payload.name == u"initial channel name"
        assert message.payload.description == u"initial channel description"

        # cleanup
        community.create_dispersy_destroy_community(u"hard-kill")
예제 #2
0
파일: script.py 프로젝트: Anbcorp/tribler
    def test_incoming_channel(self):
        """
        We will send a 'channel' message from NODE to SELF.
        """
        community = ChannelCommunity.create_community(self._my_member)
        address = self._dispersy.socket.get_address()

        # create node and ensure that SELF knows the node address
        node = ChannelNode(community)
        node.init_socket()
        node.init_my_member()
        yield 0.1

        # send a 'channel' message
        global_time = 10
        node.send_message(node.create_channel(u"channel name #1", u"channel description #1", global_time), address)
        yield 0.1

        # cleanup
        community.create_dispersy_destroy_community(u"hard-kill")
예제 #3
0
파일: script.py 프로젝트: zzmjohn/tribler
    def test_incoming_channel(self):
        """
        We will send a 'channel' message from NODE to SELF.
        """
        community = ChannelCommunity.create_community(self._my_member)
        address = self._dispersy.socket.get_address()

        # create node and ensure that SELF knows the node address
        node = ChannelNode(community)
        node.init_socket()
        node.init_my_member()
        yield 0.1

        # send a 'channel' message
        global_time = 10
        node.send_message(
            node.create_channel(u"channel name #1", u"channel description #1",
                                global_time), address)
        yield 0.1

        # cleanup
        community.create_dispersy_destroy_community(u"hard-kill")
예제 #4
0
파일: script.py 프로젝트: Anbcorp/tribler
    def test_outgoing_channel(self):
        """
        We will send a 'channel' message from SELF to NODE.
        """
        community = ChannelCommunity.create_community(self._my_member)
        address = self._dispersy.socket.get_address()

        # create node and ensure that SELF knows the node address
        node = ChannelNode(community)
        node.init_socket()
        node.init_my_member()
        yield 0.1

        # send a 'channel' message
        community.create_channel(u"initial channel name", u"initial channel description")
        yield 0.1

        _, message = node.receive_message(addresses=[address], message_names=[u"channel"])
        assert message.payload.name == u"initial channel name"
        assert message.payload.description == u"initial channel description"

        # cleanup
        community.create_dispersy_destroy_community(u"hard-kill")