Skip to content

Commit

Permalink
test: update test adding compound queries with id filter issue #160
Browse files Browse the repository at this point in the history
  • Loading branch information
AxeemHaider committed Nov 22, 2022
1 parent f98af09 commit e59a1a9
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from fireo.fields.errors import AttributeTypeError
from fireo.fields import TextField, IDField
from fireo.fields import TextField, IDField, BooleanField
from fireo.models import Model

# first try with default field name
Expand Down Expand Up @@ -91,4 +91,27 @@ class TestIssue160Model(Model):
num_results = sum(1 for _ in results)
assert num_results == 1
except Exception:
assert True == False
assert True == False

def test_issue_160_with_compound_queries():
class TestIssue160Model(Model):
name = TextField()
is_deleted = BooleanField()

test1 = TestIssue160Model(name='test1', is_deleted=False)
test1.save()

test2 = TestIssue160Model(name='test2', is_deleted=True)
test2.save()

test3 = TestIssue160Model(name='test3', is_deleted=True)
test3.save()

try:
docs = TestIssue160Model.collection.filter("id", "in", [test1.id, test2.id]).filter("is_deleted", "==", False).fetch()
doc = next(docs)

assert doc.id == test1.id
assert doc.name == test1.name
except Exception:
assert False == True

0 comments on commit e59a1a9

Please sign in to comment.