Non consistant assertExactQueries in memberships tests
Visible on the dev setup (Erwan, Valentin):
- Works running
manage.py test arkindex.documents.tests.tasks.test_corpus_delete
- Fail running
manage.py test
In some conditions, the Corpus ContentType is cached and is not part of the exact SQL query.
======================================================================
FAIL: test_run (arkindex.documents.tests.tasks.test_corpus_delete.TestDeleteCorpus)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lucidiot/dev/ark/backend/arkindex/documents/tests/tasks/test_corpus_delete.py", line 123, in test_run
corpus_delete(self.corpus.id)
File "/home/lucidiot/dev/ark/backend/arkindex/project/tests/__init__.py", line 70, in __exit__
self.test_case.assertEqual(expected_sql, actual_sql)
AssertionError: 'SELE[375 chars];\n\nDELETE\nFROM "documents_allowedmetadata"\[5438 chars]uuid' != 'SELE[375 chars];\n\nSELECT "django_content_type"."id",\n [5710 chars]uuid'
SELECT "documents_corpus"."created",
"documents_corpus"."updated",
"documents_corpus"."id",
"documents_corpus"."name",
"documents_corpus"."description",
"documents_corpus"."repository_id",
"documents_corpus"."public"
FROM "documents_corpus"
WHERE "documents_corpus"."id" = '07df48d1-5a28-428d-a7b8-8a17e14bda82'::uuid
+ LIMIT 21;
+
+ SELECT "django_content_type"."id",
+ "django_content_type"."app_label",
+ "django_content_type"."model"
+ FROM "django_content_type"
+ WHERE ("django_content_type"."app_label" = 'documents'
+ AND "django_content_type"."model" = 'corpus')
LIMIT 21;