diff options
Diffstat (limited to 'tests/test_json.py')
-rw-r--r-- | tests/test_json.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_json.py b/tests/test_json.py index da399325c..f87a32139 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -11,21 +11,25 @@ url = "http://localhost:8001/api/%s" class TestJson(object): + 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") @@ -34,12 +38,14 @@ class TestJson(object): 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") |