Skip to content

Commit

Permalink
Test very long string on indexed column. Refs midgardprojectgh-198
Browse files Browse the repository at this point in the history
  • Loading branch information
piotras committed Apr 2, 2013
1 parent 7b3198b commit 46a6cb1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/GIR/test_query_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,30 @@ def testValue(self):
query_value.set_value(some_float)
self.assertEqual(query_value.get_value(), some_float)

def testVeryLongStringConstraintWithIndexedColumn(self):
# https://github.com/midgardproject/midgard-core/issues/198
long_firstname = "thisisareallyreallylongstringtomakesurewerelongerthantheindex@unitteststheproblemshowedupwith86chrs.fx"
person = Midgard.Object.factory(self.mgd, "midgard_person", None)
person.set_property("firstname", long_firstname)
self.assertTrue(person.create())

st = Midgard.QueryStorage(dbclass = "midgard_person")
qs = Midgard.QuerySelect(connection = self.mgd, storage = st)
qs.set_constraint(
Midgard.QueryConstraint(
property = Midgard.QueryProperty(property = "firstname"),
operator = "=",
holder = Midgard.QueryValue.create_with_value(long_firstname)
)
)
qs.execute()
objects = qs.list_objects()
self.assertEqual(len(objects), 1)
p = objects[0]
self.assertEqual(p.get_property("firstname"), long_firstname)

person.purge(False)

def testInheritance(self):
qs = Midgard.QuerySelect(connection = self.mgd)
self.assertIsInstance(qs, Midgard.QueryExecutor)
Expand Down

0 comments on commit 46a6cb1

Please sign in to comment.