Skip to content

Commit

Permalink
bugfixesg
Browse files Browse the repository at this point in the history
  • Loading branch information
lfdversluis committed Jul 29, 2016
1 parent b39352f commit 1af55d9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Tribler/Core/Modules/channel/channel_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def create_channel(self, name, description, mode, rss_url=None):
raise DuplicateChannelNameError(u"Channel name already exists: %s" % name)

channel_mode = self._channel_mode_map[mode]
community = ChannelCommunity.create_community(self.dispersy, self.session.dispersy_member,
community = yield ChannelCommunity.create_community(self.dispersy, self.session.dispersy_member,
tribler_session=self.session)

channel_obj = ChannelObject(self.session, community)
Expand Down
4 changes: 3 additions & 1 deletion Tribler/Core/Session.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ def create_channel(self, name, description, mode=u'closed'):
:return: Channel ID
:raises DuplicateChannelNameError if name already exists
"""
print self.lm.channel_manager.create_channel
res = yield self.lm.channel_manager.create_channel(name, description, mode)
returnValue(res)

Expand All @@ -719,7 +720,8 @@ def add_torrent_def_to_channel(self, channel_id, torrent_def, extra_info={}, for
raise DuplicateTorrentFileError()

dispersy_cid = str(channelcast_db.getDispersyCIDFromChannelId(channel_id))
community = self.get_dispersy_instance().get_community(dispersy_cid)
dispersy = self.get_dispersy_instance()
community = yield dispersy.get_community(dispersy_cid)

yield community._disp_create_torrent(
torrent_def.infohash,
Expand Down
7 changes: 4 additions & 3 deletions Tribler/Test/API/test_seeding.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
import logging
import os
import socket
import sys
import threading
import time

from twisted.internet.defer import inlineCallbacks

from nose.twistedtools import deferred

from Tribler.Core.DownloadConfig import DownloadStartupConfig
from Tribler.Core.Session import Session
from Tribler.Core.TorrentDef import TorrentDef
from Tribler.Core.Utilities.twisted_thread import deferred
from Tribler.Core.simpledefs import DLSTATUS_SEEDING, dlstatus_strings
from Tribler.Test.btconn import BTConnection
from Tribler.Test.test_as_server import TESTS_DATA_DIR, TestAsServer
Expand Down Expand Up @@ -93,7 +94,7 @@ def seeder_state_callback(self, ds):

return 1.0, False

@deferred(timeout=5)
@deferred(timeout=10)
@inlineCallbacks
def test_normal_torrent(self):
self.setup_seeder()
Expand Down
2 changes: 0 additions & 2 deletions Tribler/Test/Community/Tunnel/FullSession/test_tunnel_base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import time
from twisted.internet.defer import returnValue, inlineCallbacks

from Tribler.Core.DownloadConfig import DownloadStartupConfig
from Tribler.Core.TorrentDef import TorrentDef
from Tribler.Core.Utilities.twisted_thread import deferred
from Tribler.Core.simpledefs import dlstatus_strings
from Tribler.Test.test_as_server import TESTS_DATA_DIR, TestAsServer
from Tribler.community.tunnel.hidden_community import HiddenTunnelCommunity
Expand Down
5 changes: 2 additions & 3 deletions Tribler/Test/Community/channel/test_channel_community.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from twisted.internet.defer import inlineCallbacks

from Tribler.Core.Utilities.twisted_thread import deferred
from nose.twistedtools import deferred

from Tribler.Test.Community.channel.test_channel_base import AbstractTestChannelCommunity
from Tribler.Test.Core.base_test import MockObject
from Tribler.dispersy.util import blocking_call_on_reactor_thread


class TestChannelCommunity(AbstractTestChannelCommunity):

@deferred(timeout=10)
@blocking_call_on_reactor_thread
@inlineCallbacks
def test_initialize(self):
def raise_runtime():
Expand Down
6 changes: 5 additions & 1 deletion Tribler/Test/Core/Modules/RestApi/base_api_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import json
import urllib

from nose.twistedtools import reactor

from twisted.internet.defer import succeed
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers
from twisted.web.iweb import IBodyProducer

from zope.interface import implements
from Tribler.Core.Utilities.twisted_thread import reactor

from Tribler.Core.version import version_id
from Tribler.Test.test_as_server import TestAsServer

Expand Down
3 changes: 2 additions & 1 deletion Tribler/Test/Core/Modules/RestApi/test_search_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Tribler.Core.Utilities.twisted_thread import deferred
from nose.twistedtools import deferred

from Tribler.Core.simpledefs import NTFY_CHANNELCAST, NTFY_TORRENTS, SIGNAL_CHANNEL, SIGNAL_ON_SEARCH_RESULTS, \
SIGNAL_TORRENT
from Tribler.Test.Core.Modules.RestApi.base_api_test import AbstractApiTest
Expand Down
9 changes: 5 additions & 4 deletions Tribler/Test/Core/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from nose.tools import raises
from twisted.internet.defer import Deferred, inlineCallbacks

from nose.twistedtools import deferred

from Tribler.Core.Session import Session
from Tribler.Core.SessionConfig import SessionStartupConfig
from Tribler.Core.Utilities.twisted_thread import deferred
from Tribler.Core.exceptions import OperationNotEnabledByConfigurationException, DuplicateTorrentFileError
from Tribler.Core.leveldbstore import LevelDbStore
from Tribler.Core.simpledefs import NTFY_CHANNELCAST, DLSTATUS_STOPPED, SIGNAL_CHANNEL, SIGNAL_ON_CREATED
from Tribler.Core.TorrentDef import TorrentDef
from Tribler.Test.Core.base_test import TriblerCoreTest
from Tribler.Test.common import TORRENT_FILE
from Tribler.Test.test_as_server import TestAsServer
from Tribler.dispersy.util import blocking_call_on_reactor_thread


class TestSession(TriblerCoreTest):
Expand Down Expand Up @@ -97,9 +97,11 @@ def test_add_torrent_def_to_channel(self):

torrent_def = TorrentDef.load(TORRENT_FILE)

@blocking_call_on_reactor_thread
print "HIER"

@inlineCallbacks
def on_channel_created(subject, change_type, object_id, channel_data):
print "HIER2"
channel_id = self.channel_db_handler.getMyChannelId()
yield self.session.add_torrent_def_to_channel(channel_id, torrent_def, {"description": "iso"}, forward=False)
self.assertTrue(self.channel_db_handler.hasTorrent(channel_id, torrent_def.get_infohash()))
Expand All @@ -120,7 +122,6 @@ def test_add_torrent_def_to_channel_duplicate(self):

torrent_def = TorrentDef.load(TORRENT_FILE)

@blocking_call_on_reactor_thread
@inlineCallbacks
def on_channel_created(subject, change_type, object_id, channel_data):
channel_id = self.channel_db_handler.getMyChannelId()
Expand Down

0 comments on commit 1af55d9

Please sign in to comment.