Skip to content

Commit

Permalink
test: fix test_indexer for change from list to tuples in config.
Browse files Browse the repository at this point in the history
  • Loading branch information
rouilj committed Mar 31, 2024
1 parent 12918e5 commit ec9d00b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/test_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,17 @@ def test_invalid_indexer(self):
# mangle things so we can test AssertionError at end
# get_indexer()
from roundup.configuration import IndexerOption
IndexerOption.allowed.append("unrecognized_indexer")
io_orig = IndexerOption.allowed
io = list(io_orig)
io.append("unrecognized_indexer")
IndexerOption.allowed = tuple(io)
self.db.config['INDEXER'] = "unrecognized_indexer"

with self.assertRaises(AssertionError) as cm:
indexer = get_indexer(self.db.config, self.db)

# unmangle state
IndexerOption.allowed.pop()
IndexerOption.allowed = io_orig
self.assertNotIn("unrecognized_indexer", IndexerOption.allowed)
self.db.config['INDEXER'] = ""

Expand Down Expand Up @@ -580,7 +583,10 @@ def test_invalid_language(self):
import psycopg2

from roundup.configuration import IndexerOption
IndexerOption.valid_langs.append("foo")
io_orig = IndexerOption.valid_langs

io = list(io_orig)
io.append("foo")
self.db.config["INDEXER_LANGUAGE"] = "foo"

with self.assertRaises(psycopg2.errors.UndefinedObject) as ctx:
Expand All @@ -596,6 +602,7 @@ def test_invalid_language(self):
self.db.rollback()

self.db.config["INDEXER_LANGUAGE"] = "english"
IndexerOption.valid_langs = io_orig

def testNullChar(self):
"""Test with null char in string. Postgres FTS throws a ValueError
Expand Down

0 comments on commit ec9d00b

Please sign in to comment.