Skip to content

Commit 280262f

Browse files
committed
Update tests for removal of bulk-index and bulk-delete
Why these changes are being introduced: With the removal of CLI commands bulk-index and bulk-delete, the test suite needed some updates. How this addresses that need: * Recreate VCR cassettes for bulk indexing and deleting by using local parquet dataset fixtures * Remove helpers no longer needed; parsing previous JSON and TXT files for input Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/TIMX-491
1 parent cdb5c84 commit 280262f

30 files changed

+684
-1778
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ safety: # Check for security vulnerabilities and verify Pipfile.lock is up-to-da
5252
pipenv run pip-audit
5353
pipenv verify
5454

55-
lint-apply: # Apply changes with 'black' and resolve 'fixable errors' with 'ruff'
56-
black-apply ruff-apply
55+
lint-apply: black-apply ruff-apply # Apply changes with 'black' and resolve 'fixable errors' with 'ruff'
5756

5857
black-apply: # Apply changes with 'black'
5958
pipenv run black .

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pytest = "*"
2424
ruff = "*"
2525
vcrpy = "*"
2626
pip-audit = "*"
27+
ipython = "*"
2728

2829
[requires]
2930
python_version = "3.12"

Pipfile.lock

Lines changed: 118 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/conftest.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22
import vcr
33
from click.testing import CliRunner
4+
from timdex_dataset_api import TIMDEXDataset
45

56
import tim.opensearch as tim_os
67

@@ -33,3 +34,38 @@ def test_opensearch_client():
3334
@pytest.fixture
3435
def runner():
3536
return CliRunner()
37+
38+
39+
@pytest.fixture
40+
def timdex_dataset() -> TIMDEXDataset:
41+
td = TIMDEXDataset("tests/fixtures/dataset")
42+
td.load()
43+
return td
44+
45+
46+
@pytest.fixture
47+
def five_valid_index_libguides_records(timdex_dataset):
48+
return timdex_dataset.read_transformed_records_iter(
49+
run_id="85cfe316-089c-4639-a5af-c861a7321493"
50+
)
51+
52+
53+
@pytest.fixture
54+
def one_invalid_index_libguides_records(timdex_dataset):
55+
return timdex_dataset.read_transformed_records_iter(
56+
run_id="21e7f272-7b96-480c-9c25-36075355fc4c"
57+
)
58+
59+
60+
@pytest.fixture
61+
def one_valid_delete_libguides_records(timdex_dataset):
62+
return timdex_dataset.read_transformed_records_iter(
63+
run_id="59d938b9-df61-481b-bec9-9d9eb8fbf21c"
64+
)
65+
66+
67+
@pytest.fixture
68+
def one_valid_delete_libguides_records_not_found(timdex_dataset):
69+
return timdex_dataset.read_transformed_records_iter(
70+
run_id="3718935d-2bc0-4385-919e-c7a83238215e"
71+
)

tests/fixtures/cassettes/cli/bulk_delete_with_index_name_success.yaml

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)