diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-07-19 02:15:02 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-07-19 02:15:02 +0200 |
commit | 9e0ef7f722c606863c7388ac5c606c7859038ff2 (patch) | |
tree | e3586b502870c6c2d941da51355cbfe8ba07eca9 /tests | |
parent | print "" -> print (diff) | |
download | pyload-9e0ef7f722c606863c7388ac5c606c7859038ff2.tar.xz |
Move test stuff to common directory
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_api.py | 21 | ||||
-rw-r--r-- | tests/test_json.py | 49 |
2 files changed, 0 insertions, 70 deletions
diff --git a/tests/test_api.py b/tests/test_api.py deleted file mode 100644 index 99e84b3ab..000000000 --- a/tests/test_api.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# -*- 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() diff --git a/tests/test_json.py b/tests/test_json.py deleted file mode 100644 index d06457473..000000000 --- a/tests/test_json.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -*- 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 |