Skip to content
Snippets Groups Projects
Commit 740d8999 authored by Valentin Rigal's avatar Valentin Rigal
Browse files

Add a test case

parent e700a1bd
No related branches found
No related tags found
No related merge requests found
......@@ -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)
]
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment