def test_filter_queryset_hash(self): queryset = HashLookupTestModel.objects_hash.filter(url=TEST_URL) sql_with_params = queryset.query.sql_with_params() self.assertEqual(queryset.count(), 1) self.assertEqual(sql_with_params[1][0], gen_hash(TEST_URL)) self.assertIn('"tests_hashlookuptestmodel"."url_hash" = %s', sql_with_params[0])
def setUp(self): HashLookupTestModel.objects.create(url=TEST_URL, url_hash=gen_hash(TEST_URL))