예제 #1
0
    def test_knows_if_a_user_cannot_manage_authorizations(self):
        user = UserFactory()
        journal = JournalFactory(collection=self.collection)
        is_granted = user.has_perm('authorization.manage_authorizations', journal)
        self.assertEqual(is_granted, False)

        journal.members.add(user)
        journal.save()
        is_granted = user.has_perm('authorization.manage_authorizations', journal)
        self.assertEqual(is_granted, False)
예제 #2
0
    def test_knows_if_a_user_cannot_manage_authorizations(self):
        user = UserFactory()
        journal = JournalFactory(collection=self.collection)
        is_granted = user.has_perm('authorization.manage_authorizations',
                                   journal)
        self.assertEqual(is_granted, False)

        journal.members.add(user)
        journal.save()
        is_granted = user.has_perm('authorization.manage_authorizations',
                                   journal)
        self.assertEqual(is_granted, False)
예제 #3
0
    def test_user_cant_manage(self):
        issue = IssueSubmissionFactory(journal=self.journal)
        user = UserFactory()

        is_granted = user.has_perm('editor.manage_issuesubmission',
                                   issue.journal)
        self.assertEqual(is_granted, False)
예제 #4
0
    def test_user_cant_manage(self):
        issue = IssueSubmissionFactory(journal=self.journal)
        user = UserFactory()

        is_granted = user.has_perm('editor.manage_issuesubmission',
                                   issue.journal)
        self.assertEqual(is_granted, False)
예제 #5
0
 def test_knows_if_a_user_can_manage_authorizations(self):
     user = UserFactory()
     journal = JournalFactory(collection=self.collection)
     journal.members.add(user)
     journal.save()
     ct = ContentType.objects.get(app_label="erudit", model="journal")
     Authorization.objects.create(
         content_type=ct,
         user=user,
         object_id=journal.id,
         authorization_codename=AC.can_manage_authorizations.codename)
     is_granted = user.has_perm('authorization.manage_authorizations', journal)
     self.assertEqual(is_granted, True)
예제 #6
0
 def test_knows_if_a_user_can_manage_authorizations(self):
     user = UserFactory()
     journal = JournalFactory(collection=self.collection)
     journal.members.add(user)
     journal.save()
     ct = ContentType.objects.get(app_label="erudit", model="journal")
     Authorization.objects.create(
         content_type=ct,
         user=user,
         object_id=journal.id,
         authorization_codename=AC.can_manage_authorizations.codename)
     is_granted = user.has_perm('authorization.manage_authorizations',
                                journal)
     self.assertEqual(is_granted, True)
예제 #7
0
    def test_user_can_manage(self):
        journal = JournalFactory(collection=self.collection)
        user = UserFactory()
        journal.members.add(user)
        journal.save()
        ct = ContentType.objects.get(app_label="erudit", model="journal")
        Authorization.objects.create(
            content_type=ct,
            user=user,
            object_id=journal.id,
            authorization_codename=AC.can_manage_issuesubmission.codename)
        issue = IssueSubmissionFactory(journal=journal)

        is_granted = user.has_perm('editor.manage_issuesubmission',
                                   issue.journal)
        self.assertEqual(is_granted, True)
예제 #8
0
    def test_user_can_manage(self):
        journal = JournalFactory(collection=self.collection)
        user = UserFactory()
        journal.members.add(user)
        journal.save()
        ct = ContentType.objects.get(app_label="erudit", model="journal")
        Authorization.objects.create(
            content_type=ct,
            user=user,
            object_id=journal.id,
            authorization_codename=AC.can_manage_issuesubmission.codename)
        issue = IssueSubmissionFactory(journal=journal)

        is_granted = user.has_perm('editor.manage_issuesubmission',
                                   issue.journal)
        self.assertEqual(is_granted, True)
예제 #9
0
 def test_knows_that_a_staff_member_can_manage_authorizations(self):
     user = UserFactory(is_staff=True)
     journal = JournalFactory(collection=self.collection)
     is_granted = user.has_perm('authorization.manage_authorizations', journal)
     self.assertEqual(is_granted, True)
예제 #10
0
    def test_staff_can_manage(self):
        user = UserFactory(is_staff=True)
        issue = IssueSubmissionFactory(journal=self.journal)

        is_granted = user.has_perm('editor.manage_issuesubmission', issue)
        self.assertEqual(is_granted, True)
예제 #11
0
 def test_knows_that_a_staff_member_can_manage_authorizations(self):
     user = UserFactory(is_staff=True)
     journal = JournalFactory(collection=self.collection)
     is_granted = user.has_perm('authorization.manage_authorizations',
                                journal)
     self.assertEqual(is_granted, True)
예제 #12
0
    def test_staff_can_manage(self):
        user = UserFactory(is_staff=True)
        issue = IssueSubmissionFactory(journal=self.journal)

        is_granted = user.has_perm('editor.manage_issuesubmission', issue)
        self.assertEqual(is_granted, True)