summary refs log tree commit diff
path: root/tests/rest/client/v2_alpha
diff options
context:
space:
mode:
authorAlexander Maznev <alexander.maznev@gmail.com>2016-10-10 07:25:26 -0500
committerpik <alexander.maznev@gmail.com>2016-10-14 10:18:28 -0500
commitd9350b0db846dfe996971797052763428739f3ad (patch)
treec00669ff05a9d2995e0285e82fff760219dd0c28 /tests/rest/client/v2_alpha
parentMerge pull request #1160 from matrix-org/rav/401_on_password_fail (diff)
downloadsynapse-d9350b0db846dfe996971797052763428739f3ad.tar.xz
Error codes for filters
 * add tests

Signed-off-by: Alexander Maznev <alexander.maznev@gmail.com>
Diffstat (limited to 'tests/rest/client/v2_alpha')
-rw-r--r--tests/rest/client/v2_alpha/test_filter.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/rest/client/v2_alpha/test_filter.py b/tests/rest/client/v2_alpha/test_filter.py
index d1442aafac..47ca5e8c8a 100644
--- a/tests/rest/client/v2_alpha/test_filter.py
+++ b/tests/rest/client/v2_alpha/test_filter.py
@@ -19,7 +19,7 @@ from . import V2AlphaRestTestCase
 
 from synapse.rest.client.v2_alpha import filter
 
-from synapse.api.errors import StoreError
+from synapse.api.errors import StoreError, Codes
 
 
 class FilterTestCase(V2AlphaRestTestCase):
@@ -82,11 +82,20 @@ class FilterTestCase(V2AlphaRestTestCase):
         (code, response) = yield self.mock_resource.trigger_get(
             "/user/%s/filter/2" % (self.USER_ID)
         )
-        self.assertEquals(404, code)
+        self.assertEquals(400, code)
 
     @defer.inlineCallbacks
     def test_get_filter_no_user(self):
         (code, response) = yield self.mock_resource.trigger_get(
             "/user/%s/filter/0" % (self.USER_ID)
         )
-        self.assertEquals(404, code)
+        self.assertEquals(400, code)
+        self.assertEquals(response['errcode'], Codes.FORBIDDEN)
+
+    @defer.inlineCallbacks
+    def test_get_filter_missing_id(self):
+        (code, response) = yield self.mock_resource.trigger_get(
+            "/user/%s/filter/0" % (self.USER_ID)
+        )
+        self.assertEquals(400, code)
+        self.assertEquals(response['errcode'], Codes.NOT_FOUND)