summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2019-05-08 15:42:35 -0700
committerAndrew Morgan <andrew@amorgan.xyz>2019-05-08 15:42:35 -0700
commita30a778e6ced1213d42a13be84d292022ebde5da (patch)
tree6e1116e411f23377d86635b5ab6990c6931feda6
parentFix tests and various small review issues (diff)
downloadsynapse-a30a778e6ced1213d42a13be84d292022ebde5da.tar.xz
Update tests
-rw-r--r--tests/rest/media/v1/test_url_preview.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/rest/media/v1/test_url_preview.py b/tests/rest/media/v1/test_url_preview.py
index f5e4cc72e4..38fe54a0c4 100644
--- a/tests/rest/media/v1/test_url_preview.py
+++ b/tests/rest/media/v1/test_url_preview.py
@@ -297,12 +297,12 @@ class URLPreviewTests(unittest.HomeserverTestCase):
 
         # No requests made.
         self.assertEqual(len(self.reactor.tcpClients), 0)
-        self.assertEqual(channel.code, 404)
+        self.assertEqual(channel.code, 502)
         self.assertEqual(
             channel.json_body,
             {
                 'errcode': 'M_UNKNOWN',
-                'error': 'No results found',
+                'error': 'DNS resolution failure during URL preview generation',
             },
         )
 
@@ -318,12 +318,12 @@ class URLPreviewTests(unittest.HomeserverTestCase):
         request.render(self.preview_url)
         self.pump()
 
-        self.assertEqual(channel.code, 404)
+        self.assertEqual(channel.code, 502)
         self.assertEqual(
             channel.json_body,
             {
                 'errcode': 'M_UNKNOWN',
-                'error': 'No results found',
+                'error': 'DNS resolution failure during URL preview generation',
             },
         )
 
@@ -343,10 +343,10 @@ class URLPreviewTests(unittest.HomeserverTestCase):
             channel.json_body,
             {
                 'errcode': 'M_UNKNOWN',
-                'error': 'No results found',
+                'error': 'IP address blocked by IP blacklist entry',
             },
         )
-        self.assertEqual(channel.code, 404)
+        self.assertEqual(channel.code, 403)
 
     def test_blacklisted_ip_range_direct(self):
         """
@@ -358,12 +358,12 @@ class URLPreviewTests(unittest.HomeserverTestCase):
         request.render(self.preview_url)
         self.pump()
 
-        self.assertEqual(channel.code, 404)
+        self.assertEqual(channel.code, 403)
         self.assertEqual(
             channel.json_body,
             {
                 'errcode': 'M_UNKNOWN',
-                'error': 'No results found',
+                'error': 'IP address blocked by IP blacklist entry',
             },
         )
 
@@ -414,12 +414,12 @@ class URLPreviewTests(unittest.HomeserverTestCase):
         )
         request.render(self.preview_url)
         self.pump()
-        self.assertEqual(channel.code, 404)
+        self.assertEqual(channel.code, 502)
         self.assertEqual(
             channel.json_body,
             {
                 'errcode': 'M_UNKNOWN',
-                'error': 'No results found',
+                'error': 'DNS resolution failure during URL preview generation',
             },
         )
 
@@ -439,12 +439,12 @@ class URLPreviewTests(unittest.HomeserverTestCase):
 
         # No requests made.
         self.assertEqual(len(self.reactor.tcpClients), 0)
-        self.assertEqual(channel.code, 404)
+        self.assertEqual(channel.code, 502)
         self.assertEqual(
             channel.json_body,
             {
                 'errcode': 'M_UNKNOWN',
-                'error': 'No results found',
+                'error': 'DNS resolution failure during URL preview generation',
             },
         )
 
@@ -460,11 +460,11 @@ class URLPreviewTests(unittest.HomeserverTestCase):
         request.render(self.preview_url)
         self.pump()
 
-        self.assertEqual(channel.code, 404)
+        self.assertEqual(channel.code, 502)
         self.assertEqual(
             channel.json_body,
             {
                 'errcode': 'M_UNKNOWN',
-                'error': 'No results found',
+                'error': 'DNS resolution failure during URL preview generation',
             },
-        )
+        )
\ No newline at end of file