'Testing whether we do not load two different tunnel communities in the same session'

@blocking_call_on_reactor_thread
@inlineCallbacks
def test_load_other_tunnel_community(self):

    dispersy = self.session.lm.dispersy
    master_member = DummyTunnelCommunity.get_master_members(dispersy)[0]
    keypair = self.session.trustchain_keypair
    dispersy_member = dispersy.get_member(private_key=keypair.key_to_bin())
    community = DummyTunnelCommunity.init_community(dispersy, master_member, dispersy_member, tribler_session=self.session, settings=TunnelSettings())
    (yield community.unload_community())
    some_candidate = Candidate(('1.2.3.4', 1234), False)
    some_packet = self.create_valid_packet(community)
    dispersy.on_incoming_packets([(some_candidate, some_packet)])
    tunnel_communities = 0
    for community in dispersy.get_communities():
        if isinstance(community, HiddenTunnelCommunity):
            tunnel_communities += 1
    self.assertEqual(tunnel_communities, 1)
