diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-10-13 22:27:10 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-10-13 22:27:10 +0200 |
commit | 46173e352cf3c55ecf9f5892ff83d78c1996da77 (patch) | |
tree | 502236eecfbdad2fee6b83f5147135c4b76ba21f /tests/api/test_WebSocketAPI.py | |
parent | added JSON and WS client, re organized tests, new classes for easier api tests (diff) | |
download | pyload-46173e352cf3c55ecf9f5892ff83d78c1996da77.tar.xz |
added exceptions for clients, created test for WS client
Diffstat (limited to 'tests/api/test_WebSocketAPI.py')
-rw-r--r-- | tests/api/test_WebSocketAPI.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/api/test_WebSocketAPI.py b/tests/api/test_WebSocketAPI.py new file mode 100644 index 000000000..ac22d044e --- /dev/null +++ b/tests/api/test_WebSocketAPI.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from nose.tools import raises + +from module.remote.ttypes import Forbidden +from module.remote.WSClient import WSClient + +class TestWebSocketAPI: + + def setUp(self): + self.client = WSClient() + self.client.connect() + + def tearDown(self): + self.client.close() + + def test_login(self): + self.client.login("User", "test") + self.client.getServerVersion() + self.client.logout() + + def test_wronglogin(self): + ret = self.client.login("WrongUser", "wrongpw") + assert ret == False + + @raises(Forbidden) + def test_access(self): + self.client.getServerVersion() + + @raises(AttributeError) + def test_unknown_method(self): + self.client.login("User", "test") + self.client.sdfdsg() |