Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorcary committed Dec 13, 2024
1 parent c482e8e commit 6c9aa76
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/api2/test_pool_dataset_create.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from itertools import product

import pytest

from middlewared.test.integration.assets.pool import dataset
Expand All @@ -10,3 +12,22 @@ def test_pool_dataset_create_ancestors(child):
name = f"{test_ds}/{child}"
call("pool.dataset.create", {"name": name, "create_ancestors": True})
call("pool.dataset.get_instance", name)


def test_pool_dataset_query():
fields = ("id", "name")
ops = ("=", "in")
flats = (True, False)

with dataset("query_test") as ds:
# Try all combinations
results = (call(
"pool.dataset.query",
[[field, op, ds if op == "=" else [ds]]],
{"extra": {"flat": flat, "properties": []}}
) for field, op, flat in product(fields, ops, flats))

# Check all the returns are the same
first = next(results)
for next_ds in results:
assert next_ds == first

0 comments on commit 6c9aa76

Please sign in to comment.