summaryrefslogtreecommitdiffstats
path: root/tests/api/test_WebSocketBackend.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api/test_WebSocketBackend.py')
-rw-r--r--tests/api/test_WebSocketBackend.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/api/test_WebSocketBackend.py b/tests/api/test_WebSocketBackend.py
new file mode 100644
index 000000000..a9288104f
--- /dev/null
+++ b/tests/api/test_WebSocketBackend.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+from nose.tools import raises
+
+from pyload.remote.apitypes import Forbidden
+from pyload.remote.WSClient import WSClient
+
+from tests.helper.config import credentials, wsAddress
+
+class TestWebSocketBackend:
+
+ def setUp(self):
+ self.client = WSClient(wsAddress)
+ self.client.connect()
+
+ def tearDown(self):
+ self.client.close()
+
+ def test_login(self):
+ self.client.login(*credentials)
+ self.client.getServerVersion()
+ self.client.logout()
+
+ def test_wronglogin(self):
+ ret = self.client.login("WrongUser", "wrongpw")
+ assert ret is False
+
+ @raises(Forbidden)
+ def test_access(self):
+ self.client.getServerVersion()
+
+ @raises(AttributeError)
+ def test_unknown_method(self):
+ self.client.login(*credentials)
+ self.client.sdfdsg()