示例#1
0
    def test_has_successors(self):
        task_with_successor = create(Builder('task'))
        task_without_successor = create(Builder('task'))
        create(Builder('task').successor_from(task_with_successor))

        self.assertTrue(get_checker(task_with_successor).task.has_successors)
        self.assertFalse(get_checker(task_without_successor).task.has_successors)
    def test_has_successors(self):
        task_with_successor = create(Builder('task'))
        task_without_successor = create(Builder('task'))
        create(Builder('task').successor_from(task_with_successor))

        self.assertTrue(get_checker(task_with_successor).task.has_successors)
        self.assertFalse(
            get_checker(task_without_successor).task.has_successors)
    def test_is_successor_process_checks_request_for_succesor_flag(self):
        task = create(Builder('task').in_state('task-state-in-progress'))

        self.assertFalse(get_checker(task).request.is_successor_process)

        task.REQUEST.set('X-CREATING-SUCCESSOR', True)

        self.assertTrue(get_checker(task).request.is_successor_process)
    def test_is_responsible_checks_inbox_members_if_issuer_is_a_inbox(self):
        self.login(self.regular_user)
        self.task.responsible = get_current_org_unit().inbox().id()
        self.task.get_sql_object().sync_with(self.task)
        self.assertFalse(get_checker(self.task).current_user.is_responsible)

        self.login(self.secretariat_user)
        self.assertTrue(get_checker(self.task).current_user.is_responsible)
    def test_is_responsible_checks_inbox_members_if_issuer_is_a_inbox(self):
        self.login(self.regular_user)
        self.task.responsible = get_current_org_unit().inbox().id()
        self.task.get_sql_object().sync_with(self.task)
        self.assertFalse(get_checker(self.task).current_user.is_responsible)

        self.login(self.secretariat_user)
        self.assertTrue(get_checker(self.task).current_user.is_responsible)
    def test_all_subtasks_is_NOT_finished_when_cancelled_or_resolved(self):
        self.login(self.dossier_responsible)

        self.set_workflow_state('task-state-resolved', self.task)
        self.assertFalse(get_checker(self.task).task.all_subtasks_finished)

        self.set_workflow_state('task-state-cancelled', self.task)
        self.assertFalse(get_checker(self.task).task.all_subtasks_finished)
示例#7
0
    def test_is_successor_process_checks_request_for_succesor_flag(self):
        task = create(Builder('task').in_state('task-state-in-progress'))

        self.assertFalse(get_checker(task).request.is_successor_process)

        task.REQUEST.set('X-CREATING-SUCCESSOR', True)

        self.assertTrue(get_checker(task).request.is_successor_process)
示例#8
0
    def test_is_remote_request_checks_ogds_plugin_flag(self):
        task = create(Builder('task').in_state('task-state-in-progress'))

        self.assertFalse(get_checker(task).request.is_remote)

        task.REQUEST.environ['X_OGDS_AUID'] = 'rr'

        self.assertTrue(get_checker(task).request.is_remote)
    def test_is_remote_request_checks_ogds_plugin_flag(self):
        task = create(Builder('task').in_state('task-state-in-progress'))

        self.assertFalse(get_checker(task).request.is_remote)

        task.REQUEST.environ['X_OGDS_AUID'] = 'rr'

        self.assertTrue(get_checker(task).request.is_remote)
    def test_all_subtasks_is_NOT_finished_when_cancelled_or_resolved(self):
        self.login(self.dossier_responsible)

        self.set_workflow_state('task-state-resolved', self.task)
        self.assertFalse(get_checker(self.task).task.all_subtasks_finished)

        self.set_workflow_state('task-state-cancelled', self.task)
        self.assertFalse(get_checker(self.task).task.all_subtasks_finished)
    def test_is_issuer(self):
        self.login(self.dossier_responsible)
        self.task.issuer = self.dossier_responsible.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertTrue(get_checker(self.task).current_user.is_issuer)

        self.task.issuer = self.secretariat_user.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertFalse(get_checker(self.task).current_user.is_issuer)
    def test_is_responsible(self):
        self.login(self.dossier_responsible)
        self.task.responsible = self.dossier_responsible.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertTrue(get_checker(self.task).current_user.is_responsible)

        self.task.responsible = self.regular_user.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertFalse(get_checker(self.task).current_user.is_responsible)
    def test_is_issuer(self):
        self.login(self.dossier_responsible)
        self.task.issuer = self.dossier_responsible.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertTrue(get_checker(self.task).current_user.is_issuer)

        self.task.issuer = self.secretariat_user.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertFalse(get_checker(self.task).current_user.is_issuer)
    def test_is_responsible(self):
        self.login(self.dossier_responsible)
        self.task.responsible = self.dossier_responsible.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertTrue(get_checker(self.task).current_user.is_responsible)

        self.task.responsible = self.regular_user.getId()
        self.task.get_sql_object().sync_with(self.task)
        self.assertFalse(get_checker(self.task).current_user.is_responsible)
 def test_is_assigned_to_current_admin_unit(self):
     self.login(self.secretariat_user)
     self.assertTrue(get_checker(self.inbox_forwarding).task.is_assigned_to_current_admin_unit)
     additional = create(Builder('admin_unit').id(u'additional'))
     create(Builder('org_unit')
            .id(u'additional')
            .having(admin_unit=additional))
     self.inbox_forwarding.responsible_client = 'additional'
     self.inbox_forwarding.get_sql_object().sync_with(self.inbox_forwarding)
     self.assertFalse(get_checker(self.inbox_forwarding).task.is_assigned_to_current_admin_unit)
 def test_is_assigned_to_current_admin_unit(self):
     self.login(self.secretariat_user)
     self.assertTrue(
         get_checker(
             self.inbox_forwarding).task.is_assigned_to_current_admin_unit)
     additional = create(Builder('admin_unit').id(u'additional'))
     create(
         Builder('org_unit').id(u'additional').having(
             admin_unit=additional))
     self.inbox_forwarding.responsible_client = 'additional'
     self.inbox_forwarding.get_sql_object().sync_with(self.inbox_forwarding)
     self.assertFalse(
         get_checker(
             self.inbox_forwarding).task.is_assigned_to_current_admin_unit)
    def test_responsible_orgunit_agency_member_with_private_task(self):
        self.login(self.secretariat_user)
        self.task.is_private = True
        self.task.get_sql_object().sync_with(self.task)

        self.assertFalse(
            get_checker(self.task).current_user.in_responsible_orgunits_inbox_group)
 def test_all_subtasks_finished(self):
     self.login(self.dossier_responsible)
     for state in ('task-state-rejected',
                   'task-state-cancelled',
                   'task-state-tested-and-closed'):
         self.set_workflow_state(state, self.subtask)
         self.assertTrue(get_checker(self.task).task.all_subtasks_finished)
示例#19
0
    def test_responsible_orgunit_agency_member_with_private_task(self):
        self.login(self.secretariat_user)
        self.task.is_private = True
        self.task.get_sql_object().sync_with(self.task)

        self.assertFalse(
            get_checker(
                self.task).current_user.in_responsible_orgunits_inbox_group)
示例#20
0
    def test_is_responsible_checks_inbox_members_if_issuer_is_a_inbox(self):
        task1 = create(Builder('task')
                       .having(responsible=self.org_unit.inbox().id()))

        self.assertTrue(get_checker(task1).current_user.is_responsible)

        checker = Checker(task1.get_sql_object(), self.request, self.hugo)
        self.assertFalse(checker.current_user.is_responsible)
    def test_is_responsible_checks_inbox_members_if_issuer_is_a_inbox(self):
        task1 = create(
            Builder('task').having(responsible=self.org_unit.inbox().id()))

        self.assertTrue(get_checker(task1).current_user.is_responsible)

        checker = Checker(task1.get_sql_object(), self.request, self.hugo)
        self.assertFalse(checker.current_user.is_responsible)
 def test_issuing_orgunit_agency_member(self):
     """Checks if the current user is member of the issuing
     orgunit's inbox_group"""
     self.login(self.secretariat_user)
     self.assertTrue(
         get_checker(self.task).current_user.in_issuing_orgunits_inbox_group)
     checker = Checker(self.task.get_sql_object(), self.request, self.secretariat_user)
     self.assertFalse(checker.current_user.in_issuing_orgunits_inbox_group)
    def test_is_assigned_to_current_admin_unit(self):
        admin_unit = create(Builder('admin_unit').id('additional'))
        create(
            Builder('org_unit').id('additional').with_default_groups().having(
                title='Additional', admin_unit=admin_unit))

        task1 = create(
            Builder('forwarding').having(responsible_client='client1'))
        task2 = create(
            Builder('forwarding').having(responsible=TEST_USER_ID,
                                         issuer=TEST_USER_ID,
                                         responsible_client='additional'))

        self.assertTrue(
            get_checker(task1).task.is_assigned_to_current_admin_unit)
        self.assertFalse(
            get_checker(task2).task.is_assigned_to_current_admin_unit)
示例#24
0
    def test_is_assigned_to_current_admin_unit(self):
        admin_unit = create(Builder('admin_unit')
                            .id('additional'))
        create(Builder('org_unit')
               .id('additional')
               .with_default_groups()
               .having(title='Additional',
                       admin_unit=admin_unit))

        task1 = create(Builder('forwarding')
                       .having(responsible_client='client1'))
        task2 = create(Builder('forwarding')
                       .having(responsible=TEST_USER_ID,
                               issuer=TEST_USER_ID,
                               responsible_client='additional'))

        self.assertTrue(get_checker(task1).task.is_assigned_to_current_admin_unit)
        self.assertFalse(get_checker(task2).task.is_assigned_to_current_admin_unit)
    def test_all_subtasks_finished(self):
        task = create(Builder('task').in_state('task-state-in-progress'))
        create(
            Builder('task').within(task).in_state(
                'task-state-tested-and-closed'))
        create(Builder('task').within(task).in_state('task-state-rejected'))
        create(Builder('task').within(task).in_state('task-state-cancelled'))

        self.assertTrue(get_checker(task).task.all_subtasks_finished)
示例#26
0
    def test_all_subtasks_is_NOT_finished_when_cancelled_or_resolved(self):
        task = create(Builder('task').in_state('task-state-in-progress'))
        create(Builder('task')
               .within(task)
               .in_state('task-state-resolved'))
        create(Builder('task')
               .within(task)
               .in_state('task-state-cancelled'))

        self.assertFalse(get_checker(task).task.all_subtasks_finished)
 def test_issuing_orgunit_agency_member(self):
     """Checks if the current user is member of the issuing
     orgunit's inbox_group"""
     self.login(self.secretariat_user)
     self.assertTrue(
         get_checker(
             self.task).current_user.in_issuing_orgunits_inbox_group)
     checker = Checker(self.task.get_sql_object(), self.request,
                       self.secretariat_user)
     self.assertFalse(checker.current_user.in_issuing_orgunits_inbox_group)
示例#28
0
    def test_issuing_orgunit_agency_member(self):
        """Checks if the current user is member of the issuing
        orgunit's inbox_group"""

        task1 = create(Builder('task').having(issuer=TEST_USER_ID))

        self.assertTrue(
            get_checker(task1).current_user.in_issuing_orgunits_inbox_group)

        checker = Checker(task1.get_sql_object(), self.request, self.hugo)
        self.assertFalse(checker.current_user.in_issuing_orgunits_inbox_group)
    def test_issuing_orgunit_agency_member(self):
        """Checks if the current user is member of the issuing
        orgunit's inbox_group"""

        task1 = create(Builder('task').having(issuer=TEST_USER_ID))

        self.assertTrue(
            get_checker(task1).current_user.in_issuing_orgunits_inbox_group)

        checker = Checker(task1.get_sql_object(), self.request, self.hugo)
        self.assertFalse(checker.current_user.in_issuing_orgunits_inbox_group)
    def test_responsible_orgunit_agency_member(self):
        """Checks if the current user is member of the responsible
        orgunit's inbox_group"""
        self.login(self.secretariat_user)
        self.assertTrue(
            get_checker(self.task).current_user.in_responsible_orgunits_inbox_group)

        # test as well without agency
        checker = Checker(self.task.get_sql_object(), self.request, self.secretariat_user)
        self.assertFalse(
            checker.current_user.in_responsible_orgunits_inbox_group)
示例#31
0
    def test_responsible_orgunit_agency_member(self):
        """Checks if the current user is member of the responsible
        orgunit's inbox_group"""

        task1 = create(Builder('task').having(responsible_client='client1'))

        self.assertTrue(
            get_checker(task1).current_user.in_responsible_orgunits_inbox_group)

        checker = Checker(task1.get_sql_object(), self.request, self.hugo)
        self.assertFalse(
            checker.current_user.in_responsible_orgunits_inbox_group)
示例#32
0
    def test_all_subtasks_finished(self):
        task = create(Builder('task').in_state('task-state-in-progress'))
        create(Builder('task')
               .within(task)
               .in_state('task-state-tested-and-closed'))
        create(Builder('task')
               .within(task)
               .in_state('task-state-rejected'))
        create(Builder('task')
               .within(task)
               .in_state('task-state-cancelled'))

        self.assertTrue(get_checker(task).task.all_subtasks_finished)
    def test_responsible_orgunit_agency_member(self):
        """Checks if the current user is member of the responsible
        orgunit's inbox_group"""

        task1 = create(Builder('task').having(responsible_client='client1'))

        self.assertTrue(
            get_checker(
                task1).current_user.in_responsible_orgunits_inbox_group)

        checker = Checker(task1.get_sql_object(), self.request, self.hugo)
        self.assertFalse(
            checker.current_user.in_responsible_orgunits_inbox_group)
    def test_responsible_orgunit_agency_member(self):
        """Checks if the current user is member of the responsible
        orgunit's inbox_group"""
        self.login(self.secretariat_user)
        self.assertTrue(
            get_checker(
                self.task).current_user.in_responsible_orgunits_inbox_group)

        # test as well without agency
        checker = Checker(self.task.get_sql_object(), self.request,
                          self.secretariat_user)
        self.assertFalse(
            checker.current_user.in_responsible_orgunits_inbox_group)
示例#35
0
    def is_modify_allowed(self, include_agency=True):
        """Check if the current user is allowed to modify the deadline:
        - state is `in-progress` or `open`
        - and is issuer or agency member (adminstrator or issuing
        orgunit agency member).
        """
        # TODO: should be solved by a own permission 'modify_deadline'
        # but right now the issuer has not a sperate role.

        if not self.context.is_editable:
            return False

        checker = get_checker(self.context)
        if not include_agency:
            return checker.current_user.is_issuer
        else:
            return (checker.current_user.is_issuer
                    or checker.current_user.in_issuing_orgunits_inbox_group
                    or checker.current_user.is_administrator)
    def is_modify_allowed(self, include_agency=True):
        """Check if the current user is allowed to modify the deadline:
        - state is `in-progress` or `open`
        - and is issuer or agency member (adminstrator or issuing
        orgunit agency member).
        """
        # TODO: should be solved by a own permission 'modify_deadline'
        # but right now the issuer has not a sperate role.

        if not self.context.is_editable:
            return False

        checker = get_checker(self.context)
        if not include_agency:
            return checker.current_user.is_issuer
        else:
            return (checker.current_user.is_issuer or
                    checker.current_user.in_issuing_orgunits_inbox_group or
                    checker.current_user.is_administrator)
    def test_all_subtasks_is_NOT_finished_when_cancelled_or_resolved(self):
        task = create(Builder('task').in_state('task-state-in-progress'))
        create(Builder('task').within(task).in_state('task-state-resolved'))
        create(Builder('task').within(task).in_state('task-state-cancelled'))

        self.assertFalse(get_checker(task).task.all_subtasks_finished)
    def test_is_responsible(self):
        task1 = create(Builder('task').having(responsible=TEST_USER_ID))
        task2 = create(Builder('task').having(responsible='hugo.boss'))

        self.assertTrue(get_checker(task1).current_user.is_responsible)
        self.assertFalse(get_checker(task2).current_user.is_responsible)
    def test_is_issuer(self):
        task1 = create(Builder('task').having(issuer=TEST_USER_ID))
        task2 = create(Builder('task').having(issuer='hugo.boss'))

        self.assertTrue(get_checker(task1).current_user.is_issuer)
        self.assertFalse(get_checker(task2).current_user.is_issuer)
示例#40
0
    def test_is_issuer(self):
        task1 = create(Builder('task').having(issuer=TEST_USER_ID))
        task2 = create(Builder('task').having(issuer='hugo.boss'))

        self.assertTrue(get_checker(task1).current_user.is_issuer)
        self.assertFalse(get_checker(task2).current_user.is_issuer)
 def test_is_remote_request_checks_ogds_plugin_flag(self):
     self.login(self.regular_user)
     self.assertFalse(get_checker(self.task).request.is_remote)
     self.task.REQUEST.environ['X_OGDS_AUID'] = 'rr'
     self.assertTrue(get_checker(self.task).request.is_remote)
 def test_is_successor_process_checks_request_for_succesor_flag(self):
     self.login(self.regular_user)
     self.assertFalse(get_checker(self.task).request.is_successor_process)
     self.task.REQUEST.set('X-CREATING-SUCCESSOR', True)
     self.assertTrue(get_checker(self.task).request.is_successor_process)
示例#43
0
    def test_is_responsible(self):
        task1 = create(Builder('task').having(responsible=TEST_USER_ID))
        task2 = create(Builder('task').having(responsible='hugo.boss'))

        self.assertTrue(get_checker(task1).current_user.is_responsible)
        self.assertFalse(get_checker(task2).current_user.is_responsible)
 def test_is_successor_process_checks_request_for_succesor_flag(self):
     self.login(self.regular_user)
     self.assertFalse(get_checker(self.task).request.is_successor_process)
     self.task.REQUEST.set('X-CREATING-SUCCESSOR', True)
     self.assertTrue(get_checker(self.task).request.is_successor_process)
 def test_is_remote_request_checks_ogds_plugin_flag(self):
     self.login(self.regular_user)
     self.assertFalse(get_checker(self.task).request.is_remote)
     self.task.REQUEST.environ['X_OGDS_AUID'] = 'rr'
     self.assertTrue(get_checker(self.task).request.is_remote)
    def test_has_successors(self):
        self.login(self.dossier_responsible)
        self.register_successor(self.task, self.subtask)

        self.assertTrue(get_checker(self.task).task.has_successors)
        self.assertFalse(get_checker(self.subtask).task.has_successors)
 def test_all_subtasks_finished_is_allways_true_when_no_subtask_exists(self):
     self.login(self.dossier_responsible)
     self.assertTrue(get_checker(self.expired_task).task.all_subtasks_finished)
    def test_has_successors(self):
        self.login(self.dossier_responsible)
        self.register_successor(self.task, self.subtask)

        self.assertTrue(get_checker(self.task).task.has_successors)
        self.assertFalse(get_checker(self.subtask).task.has_successors)
 def test_all_subtasks_finished_is_allways_true_when_no_subtask_exists(
         self):
     self.login(self.dossier_responsible)
     self.assertTrue(
         get_checker(self.archive_task).task.all_subtasks_finished)
 def test_all_subtasks_finished(self):
     self.login(self.dossier_responsible)
     for state in ('task-state-rejected', 'task-state-cancelled',
                   'task-state-tested-and-closed'):
         self.set_workflow_state(state, self.subtask)
         self.assertTrue(get_checker(self.task).task.all_subtasks_finished)
    def test_all_subtasks_finished_is_allways_true_when_no_subtask_exists(
            self):
        task = create(Builder('task').in_state('task-state-in-progress'))

        self.assertTrue(get_checker(task).task.all_subtasks_finished)
示例#52
0
    def test_all_subtasks_finished_is_allways_true_when_no_subtask_exists(self):
        task = create(Builder('task').in_state('task-state-in-progress'))

        self.assertTrue(get_checker(task).task.all_subtasks_finished)