summaryrefslogtreecommitdiffstats
path: root/module/common/test_json.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-09-08 00:29:57 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-09-14 11:02:23 +0200
commit68d662e689cd42687341c550fb6ebb74e6968d21 (patch)
tree486cef41bd928b8db704894233b2cef94a6e346f /module/common/test_json.py
parentsave_join -> safe_join & save_path -> safe_filename (diff)
downloadpyload-68d662e689cd42687341c550fb6ebb74e6968d21.tar.xz
module -> pyload
Diffstat (limited to 'module/common/test_json.py')
-rw-r--r--module/common/test_json.py48
1 files changed, 0 insertions, 48 deletions
diff --git a/module/common/test_json.py b/module/common/test_json.py
deleted file mode 100644
index 320a42d4f..000000000
--- a/module/common/test_json.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- 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