Make verify_unpage for test_pool_search ignore order unless specified
This commit is contained in:
parent
e7031b3b5d
commit
d0f6a36f5e
1 changed files with 10 additions and 7 deletions
|
@ -12,13 +12,16 @@ def executor():
|
|||
|
||||
@pytest.fixture
|
||||
def verify_unpaged(executor):
|
||||
def verify(input, expected_pool_names):
|
||||
def verify(input, expected_pool_names, test_order=False):
|
||||
actual_count, actual_pools = executor.execute(
|
||||
input, offset=0, limit=100
|
||||
)
|
||||
actual_pool_names = [u.names[0].name for u in actual_pools]
|
||||
assert actual_count == len(expected_pool_names)
|
||||
if not test_order:
|
||||
actual_pool_names = sorted(actual_pool_names)
|
||||
expected_pool_names = sorted(expected_pool_names)
|
||||
assert actual_pool_names == expected_pool_names
|
||||
assert actual_count == len(expected_pool_names)
|
||||
|
||||
return verify
|
||||
|
||||
|
@ -338,7 +341,7 @@ def test_sort_by_name(
|
|||
db.session.add(pool_factory(id=2, names=["t2"]))
|
||||
db.session.add(pool_factory(id=1, names=["t1"]))
|
||||
db.session.flush()
|
||||
verify_unpaged(input, expected_pool_names)
|
||||
verify_unpaged(input, expected_pool_names, test_order=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -360,7 +363,7 @@ def test_sort_by_creation_time(
|
|||
pool3.creation_time = datetime(1991, 1, 3)
|
||||
db.session.add_all([pool3, pool1, pool2])
|
||||
db.session.flush()
|
||||
verify_unpaged(input, expected_pool_names)
|
||||
verify_unpaged(input, expected_pool_names, test_order=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -384,7 +387,7 @@ def test_sort_by_last_edit_time(
|
|||
pool3.last_edit_time = datetime(1991, 1, 3)
|
||||
db.session.add_all([pool3, pool1, pool2])
|
||||
db.session.flush()
|
||||
verify_unpaged(input, expected_pool_names)
|
||||
verify_unpaged(input, expected_pool_names, test_order=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -405,7 +408,7 @@ def test_sort_by_post_count(
|
|||
pool2.posts.append(post1)
|
||||
pool2.posts.append(post2)
|
||||
db.session.flush()
|
||||
verify_unpaged(input, expected_pool_names)
|
||||
verify_unpaged(input, expected_pool_names, test_order=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -428,4 +431,4 @@ def test_sort_by_category(
|
|||
pool3 = pool_factory(id=3, names=["t3"], category=cat1)
|
||||
db.session.add_all([pool1, pool2, pool3])
|
||||
db.session.flush()
|
||||
verify_unpaged(input, expected_pool_names)
|
||||
verify_unpaged(input, expected_pool_names, test_order=True)
|
||||
|
|
Loading…
Reference in a new issue