summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CrypterPluginTester.py6
-rw-r--r--tests/HosterPluginTester.py3
-rwxr-xr-xtests/clonedigger.sh2
-rw-r--r--tests/config/db.version1
-rw-r--r--tests/config/plugin.conf138
-rw-r--r--tests/config/pyload.conf.org75
-rw-r--r--tests/config/pyload.db.orgbin0 -> 13312 bytes
-rwxr-xr-xtests/nosetests.sh5
-rwxr-xr-xtests/pyflakes.sh2
-rwxr-xr-xtests/quit_pyload.sh4
-rwxr-xr-xtests/run_pyload.sh17
-rwxr-xr-xtests/sloccount.sh2
-rw-r--r--tests/stubs/__init__.py1
-rw-r--r--tests/test_api.py8
-rw-r--r--tests/test_json.py5
-rw-r--r--tests/test_syntax.py45
-rwxr-xr-xtests/testlinks.txt26
17 files changed, 332 insertions, 8 deletions
diff --git a/tests/CrypterPluginTester.py b/tests/CrypterPluginTester.py
new file mode 100644
index 000000000..124cb4d0a
--- /dev/null
+++ b/tests/CrypterPluginTester.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+
+from unittest import TestCase
+
+class DecryptPluginTester(TestCase):
+ pass \ No newline at end of file
diff --git a/tests/HosterPluginTester.py b/tests/HosterPluginTester.py
new file mode 100644
index 000000000..faaaf799c
--- /dev/null
+++ b/tests/HosterPluginTester.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+
diff --git a/tests/clonedigger.sh b/tests/clonedigger.sh
new file mode 100755
index 000000000..69b1c13fa
--- /dev/null
+++ b/tests/clonedigger.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+clonedigger -o cpd.xml --cpd-output --ignore-dir=module/lib .
diff --git a/tests/config/db.version b/tests/config/db.version
new file mode 100644
index 000000000..bf0d87ab1
--- /dev/null
+++ b/tests/config/db.version
@@ -0,0 +1 @@
+4 \ No newline at end of file
diff --git a/tests/config/plugin.conf b/tests/config/plugin.conf
new file mode 100644
index 000000000..5e7ee3858
--- /dev/null
+++ b/tests/config/plugin.conf
@@ -0,0 +1,138 @@
+version: 2
+
+[MultiuploadCom]
+preferedHoster = multiupload
+ignoredHoster =
+
+[SerienjunkiesOrg]
+preferredHoster = RapidshareCom,UploadedTo,NetloadIn,FilefactoryCom,FreakshareNet,FilebaseTo,MegauploadCom,HotfileCom,DepositfilesCom,EasyshareCom,KickloadCom
+changeName = True
+
+[EmbeduploadCom]
+preferedHoster = embedupload
+ignoredHoster =
+
+[MultiloadCz]
+usedHoster =
+ignoredHoster =
+
+[WiiReloadedOrg]
+changeName = True
+
+[Xdcc]
+nick = pyload
+ident = pyloadident
+realname = pyloadreal
+
+[UlozTo]
+reuseCaptcha = True
+captchaUser =
+captchaNb =
+
+[YoutubeCom]
+quality = hd
+fmt = 0
+.mp4 = True
+.flv = True
+.webm = False
+.3gp = False
+
+[RapidshareCom]
+server = None
+
+[VeehdCom]
+filename_spaces = False
+replacement_char = _
+
+[RealdebridCom]
+https = False
+
+[ClickAndLoad]
+activated = True
+extern = False
+
+[ExtractArchive]
+activated = True
+fullpath = True
+overwrite = True
+passwordfile = unrar_passwords.txt
+deletearchive = False
+subfolder = False
+destination =
+queue = True
+renice = 0
+
+[CaptchaTrader]
+activated = True
+username =
+force = False
+passkey =
+
+[MergeFiles]
+activated = False
+
+[IRCInterface]
+activated = False
+host = Enter your server here!
+port = 6667
+ident = pyload-irc
+realname = pyload-irc
+nick = pyLoad-IRC
+owner = Enter your nick here!
+info_file = False
+info_pack = True
+captcha = True
+
+[Ev0InFetcher]
+activated = False
+interval = 10
+queue = False
+shows =
+quality = xvid
+hoster = NetloadIn,RapidshareCom,MegauploadCom,HotfileCom
+
+[EasybytezCom]
+activated = False
+includeHoster =
+excludeHoster =
+
+[XMPPInterface]
+activated = False
+jid = user@exmaple-jabber-server.org
+pw =
+tls = False
+owners = me@icq-gateway.org;some@msn-gateway.org
+info_file = False
+info_pack = True
+captcha = True
+
+[RehostTo]
+activated = False
+
+[MultiHoster]
+activated = True
+
+[MultiHome]
+activated = False
+interfaces = None
+
+[MultishareCz]
+activated = False
+includeHoster =
+excludeHoster = rapidshare.com|uloz.to
+
+[HotFolder]
+activated = False
+folder = container
+watch_file = False
+keep = True
+file = links.txt
+
+[ExternalScripts]
+activated = True
+
+[UpdateManager]
+activated = True
+interval = 360
+debug = False
+
diff --git a/tests/config/pyload.conf.org b/tests/config/pyload.conf.org
new file mode 100644
index 000000000..7fb1c8c87
--- /dev/null
+++ b/tests/config/pyload.conf.org
@@ -0,0 +1,75 @@
+version: 2
+
+[remote]
+nolocalauth = False
+activated = True
+port = 7227
+listenaddr = 127.0.0.1
+
+[log]
+log_size = 100
+log_folder = Logs
+file_log = False
+log_count = 5
+log_rotate = True
+
+[permission]
+group = users
+change_dl = False
+change_file = False
+user = user
+file = 0644
+change_group = False
+folder = 0755
+change_user = False
+
+[general]
+language = en
+download_folder = Downloads
+checksum = False
+folder_per_package = True
+debug_mode = True
+min_free_space = 200
+renice = 0
+
+[ssl]
+cert = ssl.crt
+activated = False
+key = ssl.key
+
+[webinterface]
+template = default
+activated = True
+prefix =
+server = builtin
+host = 127.0.0.1
+https = False
+port = 8001
+
+[proxy]
+username =
+proxy = False
+address = localhost
+password =
+type = http
+port = 7070
+
+[reconnect]
+endTime = 0:00
+activated = False
+method = ./reconnect.sh
+startTime = 0:00
+
+[download]
+max_downloads = 3
+limit_speed = False
+interface =
+skip_existing = False
+max_speed = -1
+ipv6 = False
+chunks = 3
+
+[downloadTime]
+start = 0:00
+end = 0:00
+
diff --git a/tests/config/pyload.db.org b/tests/config/pyload.db.org
new file mode 100644
index 000000000..d340531c5
--- /dev/null
+++ b/tests/config/pyload.db.org
Binary files differ
diff --git a/tests/nosetests.sh b/tests/nosetests.sh
new file mode 100755
index 000000000..c68861b90
--- /dev/null
+++ b/tests/nosetests.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+NS=nosetests
+which nosetests2 > /dev/null && NS=nosetests2
+$NS tests/ --with-coverage --with-xunit --cover-package=module --cover-erase
+coverage xml
diff --git a/tests/pyflakes.sh b/tests/pyflakes.sh
new file mode 100755
index 000000000..cdfc11319
--- /dev/null
+++ b/tests/pyflakes.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+find -name '*.py' |egrep -v '^.(/tests/|/module/lib)'|xargs pyflakes > pyflakes.log || :
diff --git a/tests/quit_pyload.sh b/tests/quit_pyload.sh
new file mode 100755
index 000000000..a8f81984a
--- /dev/null
+++ b/tests/quit_pyload.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+PYTHON=python
+which python2 > /dev/null && PYTHON=python2
+$PYTHON pyLoadCore.py --configdir=tests/config --quit
diff --git a/tests/run_pyload.sh b/tests/run_pyload.sh
new file mode 100755
index 000000000..66498cd10
--- /dev/null
+++ b/tests/run_pyload.sh
@@ -0,0 +1,17 @@
+#/usr/bin/env bash
+cp tests/config/pyload.db.org tests/config/pyload.db
+cp tests/config/pyload.conf.org tests/config/pyload.conf
+
+PYTHON=python
+which python2 > /dev/null && PYTHON=python2
+
+touch pyload.out
+$PYTHON pyLoadCore.py -d --configdir=tests/config > pyload.out 2> pyload.err &
+
+for i in {1..30}; do
+ grep 8001 pyload.out > /dev/null && echo "pyLoad started" && break
+ sleep 1
+done
+
+echo "pyLoad start script finished"
+
diff --git a/tests/sloccount.sh b/tests/sloccount.sh
new file mode 100755
index 000000000..98423b4f8
--- /dev/null
+++ b/tests/sloccount.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+sloccount . --duplicates --wide --details > sloccount.sc
diff --git a/tests/stubs/__init__.py b/tests/stubs/__init__.py
new file mode 100644
index 000000000..4b31e848b
--- /dev/null
+++ b/tests/stubs/__init__.py
@@ -0,0 +1 @@
+__author__ = 'christian'
diff --git a/tests/test_api.py b/tests/test_api.py
index f8901f731..76b3e1b40 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -7,14 +7,12 @@ from nose.tools import nottest
class TestApi:
def __init__(self):
- self.api = APIExerciser.APIExerciser(None, True, "TestUser", "pwhere")
+ self.api = APIExerciser.APIExerciser(None, True, "TestUser", "sometestpw")
def test_login(self):
assert self.api.api.login("crapp", "wrong pw") is False
- #takes really long, only test when needed
- @nottest
+ #@nottest
def test_random(self):
-
- for i in range(0, 100):
+ for i in range(0, 1000):
self.api.testAPI()
diff --git a/tests/test_json.py b/tests/test_json.py
index ff56e8f5a..4e8fb0e1f 100644
--- a/tests/test_json.py
+++ b/tests/test_json.py
@@ -5,7 +5,6 @@ from urllib2 import urlopen, HTTPError
from json import loads
from logging import log
-
url = "http://localhost:8001/api/%s"
class TestJson:
@@ -17,7 +16,7 @@ class TestJson:
return loads(u.read())
def setUp(self):
- u = urlopen(url % "login", data=urlencode({"username": "TestUser", "password": "pwhere"}))
+ u = urlopen(url % "login", data=urlencode({"username": "TestUser", "password": "sometestpw"}))
self.key = loads(u.read())
assert self.key is not False
@@ -45,4 +44,4 @@ class TestJson:
except HTTPError, e:
assert e.code == 404
else:
- assert False \ No newline at end of file
+ assert False
diff --git a/tests/test_syntax.py b/tests/test_syntax.py
new file mode 100644
index 000000000..82c4194da
--- /dev/null
+++ b/tests/test_syntax.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+import __builtin__
+from os import walk
+from os.path import abspath, dirname, join
+
+from unittest import TestCase
+
+PATH = abspath(join(dirname(abspath(__file__)), "..", ""))
+
+# gettext
+__builtin__._ = lambda x: x
+__builtin__.hookManager = _
+
+class TestSyntax(TestCase):
+ pass
+
+
+for path, dirs, files in walk(join(PATH, "module")):
+
+ for f in files:
+ if not f.endswith(".py") or f.startswith("__"): continue
+ fpath = join(path, f)
+ pack = fpath.replace(PATH, "")[1:-3] #replace / and .py
+ imp = pack.replace("/", ".")
+ packages = imp.split(".")
+ #__import__(imp)
+
+ # to much sideeffect when importing
+ if "web" in packages or "lib" in packages: continue
+ if "ThriftTest" in packages: continue
+
+ # currying
+ def meta(imp, sig):
+ def _test(self=None):
+ __import__(imp)
+
+ _test.func_name = sig
+ return _test
+
+ # generate test methods
+ sig = "test_%s_%s" % (packages[-2], packages[-1])
+
+
+ setattr(TestSyntax, sig, meta(imp, sig)) \ No newline at end of file
diff --git a/tests/testlinks.txt b/tests/testlinks.txt
new file mode 100755
index 000000000..428cf63ea
--- /dev/null
+++ b/tests/testlinks.txt
@@ -0,0 +1,26 @@
+sha1:
+ 961486646bf3c1d5d7a45ec32bb62e1bc4f2d894 random.bin
+md5:
+ d76505d0869f9f928a17d42d66326307 random.bin
+
+please save bandwith on our server,
+use this link only for remote uploads to new hoster
+http://get.pyload.org/static/random.bin
+---------------------------------------
+http://netload.in/datei9XirAJZs79/random.bin.htm
+http://ul.to/file/o41isx
+http://rapidshare.com/files/445996776/random.bin
+http://dl.free.fr/d4aL5dyXY
+http://www.duckload.com/dl/QggW2
+http://files.mail.ru/32EW66
+http://www.fileserve.com/file/MxjZXjX
+http://www.4shared.com/file/-O5CBhQV/random.html
+http://hotfile.com/dl/101569859/2e01f04/random.bin.html
+http://www.megaupload.com/?d=1JZLOP3B
+http://www.share.cx/files/235687689252/random.bin.html
+http://www.share-online.biz/download.php?id=PTCOX1GL6XAH
+http://www.shragle.com/files/f899389b/random.bin
+http://www10.zippyshare.com/v/76557688/file.html
+http://yourfiles.to/?d=312EC6E911
+http://depositfiles.com/files/k8la98953
+http://uploading.com/files/3896f5a1/random.bin/