diff --git a/arkindex/project/tests/test_acl_mixin.py b/arkindex/project/tests/test_acl_mixin.py index d63d47b98e298a0765d719f29072084398b20f58..e713bfa321dc66ede3dff595c2002153ad66df32 100644 --- a/arkindex/project/tests/test_acl_mixin.py +++ b/arkindex/project/tests/test_acl_mixin.py @@ -227,3 +227,18 @@ class TestACLMixin(FixtureTestCase): [(c.name, c.max_level) for c in corpora], [(c.name, Role.Guest.value) for c in Corpus.objects.filter(public=True)] ) + + def test_corpus_right_and_public(self): + # User specific rigths should be returned instead of the the defaults access for public rigths + Right.objects.create(user=self.user3, content_object=self.corpus, level=42) + corpus_acl_mixin = NewCorpusACLMixin(self.user3) + with self.assertNumQueries(1): + corpora = list(corpus_acl_mixin.readable_corpora) + self.assertCountEqual( + [(c.id, c.max_level) for c in corpora], + [ + (self.corpus1.id, 100), + (self.corpus2.id, 75), + (self.corpus.id, 42) + ] + )