first broken test for purge of search tokens
gitea/wcs/pipeline/head There was a failure building this commit
Details
gitea/wcs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
f9c2866ba9
commit
04975493ac
|
@ -1183,6 +1183,38 @@ def test_sql_criteria_fts(pub):
|
|||
assert data_class.select([st.FtsMatch(formdata1.id_display)])[0].id_display == formdata1.id_display
|
||||
|
||||
|
||||
def test_search_tokens_purge(pub):
|
||||
conn, cur = sql.get_connection_and_cursor()
|
||||
|
||||
test_formdef = FormDef()
|
||||
test_formdef.name = 'table select fts'
|
||||
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
|
||||
|
||||
t = data_class()
|
||||
t.data = {'3': 'foo'}
|
||||
t.just_created()
|
||||
t.store()
|
||||
|
||||
cur.execute("SELECT count(*) FROM wcs_search_tokens;")
|
||||
assert cur.fetchone()[0] == 42+1
|
||||
|
||||
t.data = {'3': 'chaussette'}
|
||||
t.store()
|
||||
|
||||
cur.execute("SELECT count(*) FROM wcs_search_tokens;")
|
||||
assert cur.fetchone()[0] == 73
|
||||
|
||||
sql.purge_obsolete_search_tokens()
|
||||
|
||||
cur.execute("SELECT count(*) FROM wcs_search_tokens;")
|
||||
assert cur.fetchone()[0] == 42
|
||||
|
||||
|
||||
def table_exists(cur, table_name):
|
||||
cur.execute(
|
||||
'''SELECT COUNT(*) FROM information_schema.tables
|
||||
|
|
Loading…
Reference in New Issue