AnnounceShare plugin

This commit is contained in:
shortcutme 2018-08-26 02:45:37 +02:00
parent efd1efad4d
commit 27f2c44532
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
5 changed files with 191 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import time
import copy
import gevent
import pytest
import mock
from AnnounceShare import AnnounceSharePlugin
from File import FileServer
from Peer import Peer
from Test import Spy
@pytest.mark.usefixtures("resetSettings")
@pytest.mark.usefixtures("resetTempSettings")
class TestAnnounceShare:
def testAnnounceList(self, file_server):
peer = Peer("127.0.0.1", 1544, connection_server=file_server)
assert peer.request("getTrackers")["trackers"] == []
tracker_storage = AnnounceSharePlugin.tracker_storage
tracker_storage.onTrackerFound("zero://127.0.0.1:15441")
assert peer.request("getTrackers")["trackers"] == []
# It needs to have at least one successfull announce to be shared to other peers
tracker_storage.onTrackerSuccess("zero://127.0.0.1:15441", 1.0)
assert peer.request("getTrackers")["trackers"] == ["zero://127.0.0.1:15441"]

View file

@ -0,0 +1,3 @@
from src.Test.conftest import *
from Config import config

View file

@ -0,0 +1,5 @@
[pytest]
python_files = Test*.py
addopts = -rsxX -v --durations=6
markers =
webtest: mark a test as a webtest.