示例#1
0
    def testOriginalMaintainer(self):
        """
        Even if a project is outsourced, its maintainer needs to be able to
        edit the source language and add translations as well.
        """

        self.project.outsource = self.project_outsource
        self.project.save()

        maintainer = self.project.maintainers.all()[0]

        # Check if the maintainer can add translations.
        expected_code = 200
        url = reverse('translate_resource', args=[self.project.slug,
            self.resource.slug, self.language.code])
        response = self.client[maintainer.username].get(url)
        assert_status_code(self, response, expected_code, url,
            str(maintainer.username))

        # Check if the maintainer can edit the resource
        expected_code = 200
        url = reverse('resource_edit', args=[self.project.slug,
            self.resource.slug])
        response = self.client[maintainer.username].get(url)
        assert_status_code(self, response, expected_code, url,
            str(maintainer.username))
示例#2
0
    def testAnyoneCanSubmit(self):
        """Check URL access when anyone can submit to a project."""
        self.project.anyone_submit = True
        self.project.save()

        for user_role in USER_ROLES:
            check_page_status(self, user_role, convert_url_roles(URL_ROLES_FREE))

        # Check if a simple registered user can open up Lotte
        expected_code = 200
        url = '/projects/p/project1/resource/resource1/l/pt_BR/'
        for user_role in ['registered']:
            response = self.client[user_role].get(url)
            assert_status_code(self, response, expected_code, url,
                user_role)
示例#3
0
    def testOutsourcedAccess(self):
        """Check URL access when a project outsources its access control."""

        self.project.outsource = self.project_outsource
        self.project.save()

        for user_role in USER_ROLES:
            check_page_status(self, user_role, convert_url_roles(URL_ROLES_OUTSOURCE))

        # Check if a writer and a team member of the outsource project can
        # open up Lotte
        expected_code = 200
        url = '/projects/p/project1/resource/resource1/l/pt_BR/'
        for user_role in self.EXTRA_USER_ROLES:
            response = self.client[user_role].get(url)
            assert_status_code(self, response, expected_code, url,
                user_role)