forked from pyload/pyload
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,18 +25,19 @@ | |
version="0.4.9", | ||
description='Fast, lightweight and full featured download manager.', | ||
long_description=open(PROJECT_DIR / "README").read(), | ||
keywords='', | ||
keywords = ('pyload', 'download-manager', 'one-click-hoster', 'download'), | ||
url="http://pyload.org", | ||
download_url='http://pyload.org/download', | ||
license='GPL v3', | ||
author="pyLoad Team", | ||
author_email="[email protected]", | ||
platforms = ('Any',), | ||
#package_dir={'pyload': 'src'}, | ||
packages=['pyload'], | ||
#package_data=find_package_data(), | ||
#data_files=[], | ||
include_package_data=True, | ||
exclude_package_data={'pyload': ['docs*', 'scripts*']}, #exluced from build but not from sdist | ||
exclude_package_data={'pyload': ['docs*', 'scripts*', 'tests*']}, #exluced from build but not from sdist | ||
# 'bottle >= 0.10.0' not in list, because its small and contain little modifications | ||
install_requires=['thrift >= 0.8.0', 'jinja2', 'pycurl', 'Beaker', 'BeautifulSoup>=3.2, <3.3'] + extradeps, | ||
extras_require={ | ||
|
@@ -231,6 +232,10 @@ def generate_locale(): | |
print "Locale generated" | ||
|
||
|
||
@task | ||
def tests(): | ||
call(["nosetests2"]) | ||
|
||
@task | ||
def virtualenv(options): | ||
"""Setup virtual environment""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from module.common import APIExerciser | ||
from nose.tools import nottest | ||
|
||
|
||
class TestApi: | ||
|
||
def __init__(self): | ||
self.api = APIExerciser.APIExerciser(None, True, "TestUser", "pwhere") | ||
|
||
def test_login(self): | ||
assert self.api.api.login("crapp", "wrong pw") is False | ||
|
||
#takes really long, only test when needed | ||
@nottest | ||
def test_random(self): | ||
|
||
for i in range(0, 100): | ||
self.api.testAPI() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from urllib import urlencode | ||
from urllib2 import urlopen, HTTPError | ||
from json import loads | ||
|
||
from logging import log | ||
|
||
url = "http://localhost:8001/api/%s" | ||
|
||
class TestJson: | ||
|
||
def call(self, name, post=None): | ||
if not post: post = {} | ||
post["session"] = self.key | ||
u = urlopen(url % name, data=urlencode(post)) | ||
return loads(u.read()) | ||
|
||
def setUp(self): | ||
u = urlopen(url % "login", data=urlencode({"username": "TestUser", "password": "pwhere"})) | ||
self.key = loads(u.read()) | ||
assert self.key is not False | ||
|
||
def test_wronglogin(self): | ||
u = urlopen(url % "login", data=urlencode({"username": "crap", "password": "wrongpw"})) | ||
assert loads(u.read()) is False | ||
|
||
def test_access(self): | ||
try: | ||
urlopen(url % "getServerVersion") | ||
except HTTPError, e: | ||
assert e.code == 403 | ||
else: | ||
assert False | ||
|
||
def test_status(self): | ||
ret = self.call("statusServer") | ||
log(1, str(ret)) | ||
assert "pause" in ret | ||
assert "queue" in ret | ||
|
||
def test_unknown_method(self): | ||
try: | ||
self.call("notExisting") | ||
except HTTPError, e: | ||
assert e.code == 404 | ||
else: | ||
assert False |