def test_hash(self): query_set = self.Child.objects.filter(parent_id=1L, child_field=u'thís-øne') actual = sql.hash_query(query_set.query) self.assertEqual(actual, '761c013158cf0be095b7ea575828269e')
def __init__(self, queryset, prefix='', timeout=None): query_hash = sql.hash_query(queryset.query) nickname = prefix + query_hash super(QuerySetLock, self).__init__(nickname, using=queryset.db, timeout=timeout) self.queryset = queryset
def test_hash(self): expected = 'c3bf8c32a800d765c22d94bbc945a443' for query_set in self.query_sets: actual = sql.hash_query(query_set.query) self.assertEqual(actual, expected)