Skip to content

Commit 9b1c48a

Browse files
author
notactuallyfinn
committed
reworked zenodo_sandbox_auth for cli testing
1 parent ba8b549 commit 9b1c48a

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# add option to pass zenodo sandbox auth token to pytest to run ./test/hermes_test/commands/deposit/test_invenio_e2e.py
2+
def pytest_addoption(parser):
3+
parser.addoption("--sandbox_auth", action="store", default=None)

test/hermes_test/commands/deposit/test_invenio_e2e.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# SPDX-FileContributor: Michael Fritzsche
66

77
from datetime import date
8-
from pathlib import Path
98
import sys
109

1110
import pytest
@@ -16,12 +15,11 @@
1615

1716

1817
@pytest.fixture
19-
def sandbox_auth():
20-
path = Path("./../auth.txt")
21-
if not path.exists():
18+
def sandbox_auth(pytestconfig):
19+
if pytestconfig.getoption("sandbox_auth"):
20+
yield pytestconfig.getoption("sandbox_auth")
21+
else:
2222
pytest.skip("Local auth token file does not exist.")
23-
with path.open() as f:
24-
yield f.read()
2523

2624

2725
@pytest.mark.parametrize(

test/hermes_test/commands/postprocess/test_invenio_postprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ def test_invenio_postprocess(tmp_path, monkeypatch):
8585
"referencePublication": "my_doi"
8686
}
8787
"""
88-
)
88+
)

0 commit comments

Comments
 (0)