summary refs log tree commit diff
path: root/tests/rest/admin/test_statistics.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-09-16 12:01:14 -0400
committerGitHub <noreply@github.com>2021-09-16 12:01:14 -0400
commitbfb4b858a999684ba2459ee4c3aa20270d13062d (patch)
treeff3830e83cb0a867f61a203e2e63133558a1bcc0 /tests/rest/admin/test_statistics.py
parentAdd type hints to state database module. (#10823) (diff)
downloadsynapse-bfb4b858a999684ba2459ee4c3aa20270d13062d.tar.xz
Create a constant for a small png image in tests. (#10834)
To avoid duplicating it between a few tests.
Diffstat (limited to 'tests/rest/admin/test_statistics.py')
-rw-r--r--tests/rest/admin/test_statistics.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/rest/admin/test_statistics.py b/tests/rest/admin/test_statistics.py
index 5cd82209c4..ece89a65ac 100644
--- a/tests/rest/admin/test_statistics.py
+++ b/tests/rest/admin/test_statistics.py
@@ -1,4 +1,5 @@
 # Copyright 2020 Dirk Klimpel
+# Copyright 2021 The Matrix.org Foundation C.I.C.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,7 +14,6 @@
 # limitations under the License.
 
 import json
-from binascii import unhexlify
 from typing import Any, Dict, List, Optional
 
 import synapse.rest.admin
@@ -21,6 +21,7 @@ from synapse.api.errors import Codes
 from synapse.rest.client import login
 
 from tests import unittest
+from tests.test_utils import SMALL_PNG
 
 
 class UserMediaStatisticsTestCase(unittest.HomeserverTestCase):
@@ -468,16 +469,9 @@ class UserMediaStatisticsTestCase(unittest.HomeserverTestCase):
         """
         upload_resource = self.media_repo.children[b"upload"]
         for _ in range(number_media):
-            # file size is 67 Byte
-            image_data = unhexlify(
-                b"89504e470d0a1a0a0000000d4948445200000001000000010806"
-                b"0000001f15c4890000000a49444154789c63000100000500010d"
-                b"0a2db40000000049454e44ae426082"
-            )
-
             # Upload some media into the room
             self.helper.upload_media(
-                upload_resource, image_data, tok=user_token, expect_code=200
+                upload_resource, SMALL_PNG, tok=user_token, expect_code=200
             )
 
     def _check_fields(self, content: List[Dict[str, Any]]):