Skip to content

Commit b9290e8

Browse files
authored
Fix assetattachments tests (#269)
AB#9685
1 parent 14e6b38 commit b9290e8

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

archivist/assetattachments.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ def _identity(self, identity: str, attachment_id: str) -> str:
7676
7777
identity looks like:
7878
79-
[https://app.datatrails.ai/archivist/public]assets/xxxxxxx
79+
[https://app.datatrails.ai/archivist/v2/public]assets/xxxxxxx
8080
8181
OR
8282
83-
[https://app.datatrails.ai/archivist/public]assets/xxxxxxx/events/yyyyyy
83+
[https://app.datatrails.ai/archivist/v2/public]assets/xxxxxxx/events/yyyyyy
8484
8585
where the public URL is prefixed with the schema.
8686
@@ -89,8 +89,8 @@ def _identity(self, identity: str, attachment_id: str) -> str:
8989
if self._public:
9090
# the public URL for the asset or event has to be changed
9191
url = urlparse(identity)
92-
root = "/".join(url.path.split(SEP)[:2])
93-
asset_id = "/".join(url.path.split(SEP)[2:])
92+
root = SEP.join(url.path.split(SEP)[:2])
93+
asset_id = SEP.join(url.path.split(SEP)[3:])
9494
new_url = url._replace(
9595
path=f"{root}/{ASSETATTACHMENTS_SUBPATH}/{ASSETATTACHMENTS_LABEL}/{asset_id}/{uuid}"
9696
)

unittests/testpublicassetattachments.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@
3737
}
3838
URL = "https://app.datatrails.ai"
3939
ASSET_UUID = "b2678528-0136-4876-ad56-904e12c4b4c6"
40-
ASSET_ID = f"{URL}/{ROOT}/public{ASSETS_LABEL}/{ASSET_UUID}"
40+
ASSET_ID = f"{URL}/{ROOT}/v2/public{ASSETS_LABEL}/{ASSET_UUID}"
4141
ATTACHMENT_UUID = "abcdef28-0136-4876-ad56-904e12c4b4c6"
4242
ATTACHMENT_ID = f"{ATTACHMENTS_LABEL}/{ATTACHMENT_UUID}"
4343
SUBPATH = (
4444
f"{ASSETATTACHMENTS_SUBPATH}/{ASSETATTACHMENTS_LABEL}/"
4545
f"public{ASSETS_LABEL}/{ASSET_UUID}/{ATTACHMENT_UUID}"
4646
)
47-
LOGGER.debug("Subpath %s", SUBPATH)
47+
48+
LOGGER.debug("Subpath %s/%s/%s", URL, ROOT, SUBPATH)
4849
RESPONSE = {
4950
**PROPS,
5051
"identity": ATTACHMENT_ID,

0 commit comments

Comments
 (0)