Skip to content

Commit

Permalink
Remove test-core argument from index_manuscript_mei command
Browse files Browse the repository at this point in the history
The use of the test core during testing is already defined in
test/test_settings.py
  • Loading branch information
dchiller committed May 15, 2024
1 parent d82c4c1 commit 01a7b24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,9 @@ def add_arguments(self, parser: CommandParser) -> None:
"documents for the specified manuscript before indexing the new data."
),
)
parser.add_argument(
"--test-core",
action="store_true",
help=(
"Use the test core for indexing. Used when running unittests on this"
"command. Defaults to False."
),
)

def handle(self, *args: Any, **options: Any) -> None:
if options["test_core"]:
solr_conn = SolrConnection(settings.SOLR_TEST_SERVER)
else:
solr_conn = SolrConnection(settings.SOLR_SERVER)
solr_conn = SolrConnection(settings.SOLR_SERVER)
manuscript_id = options["manuscript_id"][0]
if options.get("flush_index"):
self.flush_manuscript_ngrams_from_index(solr_conn, manuscript_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def test_index_manuscript_mei(self) -> None:
"5",
"--mei-dir",
TEST_MEI_FILES_PATH,
"--test-core",
)
results = self.solr_conn.query("*:*", fq="type:omr_ngram")
with self.subTest("Test total number of indexed documents"):
Expand All @@ -54,16 +53,12 @@ def test_flush_option(self) -> None:
"123723",
"--mei-dir",
TEST_MEI_FILES_PATH,
"--test-core",
)

with self.subTest("Check index is not empty before test"):
results = self.solr_conn.query("*:*", fq="type:omr_ngram")
self.assertGreater(len(results), 0)

with self.subTest("Test flush option"):
call_command(
"index_manuscript_mei", "123723", "--flush-index", "--test-core"
)
call_command("index_manuscript_mei", "123723", "--flush-index")
results = self.solr_conn.query("*:*", fq="type:omr_ngram")
self.assertEqual(len(results), 0)

0 comments on commit 01a7b24

Please sign in to comment.