Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openpecha/core/pecha.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def get_opf_path(pecha_id, path: str) -> Path:
return

if not path:
return download_pecha(pecha_id)
path = download_pecha(pecha_id)

path = Path(path)
if path.name.endswith(".opf"):
Expand Down
13 changes: 13 additions & 0 deletions tests/core/test_pecha.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,16 @@ def test_pecha_github_publish(tmp_path):
pecha.publish()

print(pecha.pecha_path)


def test_opf_path_OpenPechaGitRepo():
from openpecha.core.pecha import OpenPechaGitRepo
from openpecha import config
import os
os.environ["OPENPECHA_DATA_GITHUB_ORG"] = "OpenPecha-Data"
os.environ["GITHUB_TOKEN"] = "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"
os.environ["GITHUB_USERNAME"] = "gangagyatso4364"
pecha_id = "P000108"
opf = OpenPechaGitRepo(pecha_id=pecha_id)
expected_opf_path = config.PECHAS_PATH / pecha_id/ f"{pecha_id}.opf"
assert opf.opf_path == expected_opf_path