Skip to content

Commit

Permalink
TST: add working tag search test
Browse files Browse the repository at this point in the history
  • Loading branch information
shilorigins committed Sep 13, 2024
1 parent 55459a9 commit 2f1bc91
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions superscore/tests/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from enum import Flag, auto
from uuid import UUID

import pytest
Expand Down Expand Up @@ -127,6 +128,33 @@ def test_fuzzy_search(backends: _Backend):
assert len(results) == 2


@pytest.mark.parametrize('backends', [0], indirect=True)
def test_tag_search(backends: _Backend):
results = list(backends.search(
SearchTerm('tags', 'gt', set())
))
assert len(results) == 2 # only the Collection and Snapshot have .tags

class Tag(Flag):
T1 = auto()
T2 = auto()

results[0].tags = {Tag.T1}
results[1].tags = {Tag.T1, Tag.T2}
backends.update_entry(results[0])
backends.update_entry(results[1])

results = list(backends.search(
SearchTerm('tags', 'gt', {Tag.T1})
))
assert len(results) == 2

results = list(backends.search(
SearchTerm('tags', 'gt', {Tag.T1, Tag.T2})
))
assert len(results) == 1


@pytest.mark.parametrize('backends', [0], indirect=True)
def test_update_entry(backends: _Backend):
# grab an entry from the database and modify it.
Expand Down

0 comments on commit 2f1bc91

Please sign in to comment.