progress on test
gitea/wcs/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pierre Ducroquet 2024-03-05 11:21:22 +01:00
parent 04975493ac
commit 7278029828
1 changed files with 9 additions and 5 deletions

View File

@ -1186,14 +1186,18 @@ def test_sql_criteria_fts(pub):
def test_search_tokens_purge(pub):
conn, cur = sql.get_connection_and_cursor()
# purge garbage from other tests
sql.purge_obsolete_search_tokens()
# define a new table
test_formdef = FormDef()
test_formdef.name = 'table select fts'
test_formdef.name = 'table select fts tokens'
test_formdef.fields = [fields.StringField(id='3', label='string')]
test_formdef.store()
data_class = test_formdef.data_class(mode='sql')
cur.execute("SELECT count(*) FROM wcs_search_tokens;")
assert cur.fetchone()[0] == 42
assert cur.fetchone()[0] == 163
t = data_class()
t.data = {'3': 'foo'}
@ -1201,18 +1205,18 @@ def test_search_tokens_purge(pub):
t.store()
cur.execute("SELECT count(*) FROM wcs_search_tokens;")
assert cur.fetchone()[0] == 42+1
assert cur.fetchone()[0] == 164
t.data = {'3': 'chaussette'}
t.store()
cur.execute("SELECT count(*) FROM wcs_search_tokens;")
assert cur.fetchone()[0] == 73
assert cur.fetchone()[0] == 165
sql.purge_obsolete_search_tokens()
cur.execute("SELECT count(*) FROM wcs_search_tokens;")
assert cur.fetchone()[0] == 42
assert cur.fetchone()[0] == 163
def table_exists(cur, table_name):