Import the redesigned AnnounceShare under the new name TrackerShare
This commit is contained in:
parent
c1db963c76
commit
b2e92b1d10
5 changed files with 396 additions and 0 deletions
24
plugins/TrackerShare/Test/TestTrackerShare.py
Normal file
24
plugins/TrackerShare/Test/TestTrackerShare.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import pytest
|
||||
|
||||
from TrackerShare import TrackerSharePlugin
|
||||
from Peer import Peer
|
||||
from Config import config
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("resetSettings")
|
||||
@pytest.mark.usefixtures("resetTempSettings")
|
||||
class TestTrackerShare:
|
||||
def testAnnounceList(self, file_server):
|
||||
open("%s/trackers.json" % config.data_dir, "w").write("{}")
|
||||
tracker_storage = TrackerSharePlugin.tracker_storage
|
||||
tracker_storage.load()
|
||||
peer = Peer(file_server.ip, 1544, connection_server=file_server)
|
||||
assert peer.request("getTrackers")["trackers"] == []
|
||||
|
||||
tracker_storage.onTrackerFound("zero://%s:15441" % file_server.ip)
|
||||
assert peer.request("getTrackers")["trackers"] == []
|
||||
|
||||
# It needs to have at least one successfull announce to be shared to other peers
|
||||
tracker_storage.onTrackerSuccess("zero://%s:15441" % file_server.ip, 1.0)
|
||||
assert peer.request("getTrackers")["trackers"] == ["zero://%s:15441" % file_server.ip]
|
||||
|
3
plugins/TrackerShare/Test/conftest.py
Normal file
3
plugins/TrackerShare/Test/conftest.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from src.Test.conftest import *
|
||||
|
||||
from Config import config
|
5
plugins/TrackerShare/Test/pytest.ini
Normal file
5
plugins/TrackerShare/Test/pytest.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
[pytest]
|
||||
python_files = Test*.py
|
||||
addopts = -rsxX -v --durations=6
|
||||
markers =
|
||||
webtest: mark a test as a webtest.
|
Loading…
Add table
Add a link
Reference in a new issue