Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7e4c575

Browse files
committed
tests: update paths for new media repo structure
Signed-off-by: Sumner Evans <sumner@beeper.com>
1 parent 96cd566 commit 7e4c575

File tree

7 files changed

+51
-49
lines changed

7 files changed

+51
-49
lines changed

tests/replication/test_multi_media_repo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def _get_media_req(
6565
The channel for the *client* request and the *outbound* request for
6666
the media which the caller should respond to.
6767
"""
68-
resource = hs.get_media_repository_resource().children[b"download"]
68+
resource = (
69+
hs.get_media_repository_resource().children[b"r0"].children[b"download"]
70+
)
6971
channel = make_request(
7072
self.reactor,
7173
FakeSite(resource, self.reactor),

tests/rest/admin/test_admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ class QuarantineMediaTestCase(unittest.HomeserverTestCase):
6161
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
6262
# Allow for uploading and downloading to/from the media repo
6363
self.media_repo = hs.get_media_repository_resource()
64-
self.download_resource = self.media_repo.children[b"download"]
65-
self.upload_resource = self.media_repo.children[b"upload"]
64+
self.download_resource = self.media_repo.children[b"v3"].children[b"download"]
65+
self.upload_resource = self.media_repo.children[b"v3"].children[b"upload"]
6666

6767
def _ensure_quarantined(
6868
self, admin_user_tok: str, server_and_media_id: str

tests/rest/admin/test_media.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def test_delete_media(self) -> None:
123123
Tests that delete a media is successfully
124124
"""
125125

126-
download_resource = self.media_repo.children[b"download"]
127-
upload_resource = self.media_repo.children[b"upload"]
126+
download_resource = self.media_repo.children[b"v3"].children[b"download"]
127+
upload_resource = self.media_repo.children[b"v3"].children[b"upload"]
128128

129129
# Upload some media into the room
130130
response = self.helper.upload_media(
@@ -562,7 +562,7 @@ def _create_media(self) -> str:
562562
"""
563563
Create a media and return media_id and server_and_media_id
564564
"""
565-
upload_resource = self.media_repo.children[b"upload"]
565+
upload_resource = self.media_repo.children[b"v3"].children[b"upload"]
566566

567567
# Upload some media into the room
568568
response = self.helper.upload_media(
@@ -586,7 +586,7 @@ def _access_media(
586586
"""
587587
Try to access a media and check the result
588588
"""
589-
download_resource = self.media_repo.children[b"download"]
589+
download_resource = self.media_repo.children[b"v3"].children[b"download"]
590590

591591
media_id = server_and_media_id.split("/")[1]
592592
local_path = self.filepaths.local_media_filepath(media_id)
@@ -641,7 +641,7 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
641641
self.admin_user_tok = self.login("admin", "pass")
642642

643643
# Create media
644-
upload_resource = media_repo.children[b"upload"]
644+
upload_resource = media_repo.children[b"v3"].children[b"upload"]
645645

646646
# Upload some media into the room
647647
response = self.helper.upload_media(
@@ -778,7 +778,7 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
778778
self.admin_user_tok = self.login("admin", "pass")
779779

780780
# Create media
781-
upload_resource = media_repo.children[b"upload"]
781+
upload_resource = media_repo.children[b"v3"].children[b"upload"]
782782

783783
# Upload some media into the room
784784
response = self.helper.upload_media(

tests/rest/admin/test_statistics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def _create_media(self, user_token: str, number_media: int) -> None:
511511
user_token: Access token of the user
512512
number_media: Number of media to be created for the user
513513
"""
514-
upload_resource = self.media_repo.children[b"upload"]
514+
upload_resource = self.media_repo.children[b"v3"].children[b"upload"]
515515
for _ in range(number_media):
516516
# Upload some media into the room
517517
self.helper.upload_media(

tests/rest/admin/test_user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,8 +3243,8 @@ def _create_media_and_access(
32433243
Returns:
32443244
The ID of the newly created media.
32453245
"""
3246-
upload_resource = self.media_repo.children[b"upload"]
3247-
download_resource = self.media_repo.children[b"download"]
3246+
upload_resource = self.media_repo.children[b"v3"].children[b"upload"]
3247+
download_resource = self.media_repo.children[b"v3"].children[b"download"]
32483248

32493249
# Upload some media into the room
32503250
response = self.helper.upload_media(

tests/rest/media/v1/test_media_storage.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ def write_to(r):
253253
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
254254

255255
media_resource = hs.get_media_repository_resource()
256-
self.download_resource = media_resource.children[b"download"]
257-
self.thumbnail_resource = media_resource.children[b"thumbnail"]
256+
self.download_resource = media_resource.children[b"v3"].children[b"download"]
257+
self.thumbnail_resource = media_resource.children[b"v3"].children[b"thumbnail"]
258258
self.store = hs.get_datastores().main
259259
self.media_repo = hs.get_media_repository()
260260

@@ -605,8 +605,8 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
605605

606606
# Allow for uploading and downloading to/from the media repo
607607
self.media_repo = hs.get_media_repository_resource()
608-
self.download_resource = self.media_repo.children[b"download"]
609-
self.upload_resource = self.media_repo.children[b"upload"]
608+
self.download_resource = self.media_repo.children[b"v3"].children[b"download"]
609+
self.upload_resource = self.media_repo.children[b"v3"].children[b"upload"]
610610

611611
load_legacy_spam_checkers(hs)
612612

0 commit comments

Comments
 (0)