Skip to content

Commit

Permalink
temp: renamed file_path/storage_path to path/os_path for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
ormsbee committed Sep 30, 2024
1 parent 909768a commit 7fb98c8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions openedx_learning/apps/authoring/components/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,9 @@ def _error_header(error: AssetError) -> dict[str, str]:
# At this point, we know that there is valid Content that we want to send.
# This adds Content-level headers, like the hash/etag and content type.
info_headers.update(contents_api.get_content_info_headers(content))
stored_file_path = content.file_path()

# Recompute redirect headers (reminder: this should never be cached).
redirect_headers = contents_api.get_redirect_headers(stored_file_path, public)
redirect_headers = contents_api.get_redirect_headers(content.path, public)
logger.info(
"Asset redirect (uncached metadata): "
f"{component_version_uuid}/{asset_path} -> {redirect_headers}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ def test_add(self):
new_version.contents.get(componentversioncontent__key="nested/path/hello.txt")
)


def test_multiple_versions(self):
hello_content = contents_api.get_or_create_text_content(
self.learning_package.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _assert_html_content_headers(self, response):
assert response.status_code == 200
assert response.headers["Etag"] == self.html_asset_content.hash_digest
assert response.headers["Content-Type"] == "text/html"
assert response.headers["X-Accel-Redirect"] == self.html_asset_content.file_path()
assert response.headers["X-Accel-Redirect"] == self.html_asset_content.path
assert "X-Open-edX-Error" not in response.headers

def test_public_asset_response(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def test_file_path(self):
you're updating this test.
"""
content = self.html_content
assert content.file_path() == f"content/{content.learning_package.uuid}/{content.hash_digest}"
assert content.path == f"content/{content.learning_package.uuid}/{content.hash_digest}"

storage_root = settings.OPENEDX_LEARNING['MEDIA']['OPTIONS']['location']
assert content.os_path() == f"{storage_root}/{content.file_path()}"
assert content.os_path() == f"{storage_root}/{content.path}"

def test_read(self):
"""Make sure we can read the file data back."""
Expand Down

0 comments on commit 7fb98c8

Please sign in to comment.