Beispiel #1
0
    def test_pass_if_current_user_is_assigned_to_responsible_client(self):
        task = create(
            Builder('task').having(issuer=TEST_USER_ID,
                                   responsible=TEST_USER_ID,
                                   responsible_client='client1'))

        validator = MethodValidator(task, self.portal.REQUEST, None,
                                    IChooseMethodSchema['method'], None)

        validator.validate('existing_dossier')
Beispiel #2
0
    def test_pass_if_value_is_participate(self):
        task = create(
            Builder('task').having(issuer=TEST_USER_ID,
                                   responsible=TEST_USER_ID,
                                   responsible_client='client1'))

        validator = MethodValidator(task, self.portal.REQUEST, None,
                                    IChooseMethodSchema['method'], None)

        validator.validate('participate')
Beispiel #3
0
    def test_pass_if_current_user_is_assigned_to_responsible_client(self):
        task = create(Builder('task')
                      .having(
                          issuer=TEST_USER_ID,
                          responsible=TEST_USER_ID,
                          responsible_client='org-unit-1'))

        validator = MethodValidator(task, self.portal.REQUEST, None,
                                    IChooseMethodSchema['method'], None)

        validator.validate('existing_dossier')
Beispiel #4
0
    def test_pass_if_value_is_participate(self):
        task = create(Builder('task')
                      .having(
                          issuer=TEST_USER_ID,
                          responsible=TEST_USER_ID,
                          responsible_client='org-unit-1'))

        validator = MethodValidator(task, self.portal.REQUEST, None,
                                    IChooseMethodSchema['method'], None)

        validator.validate('participate')
    def test_raise_invalid_if_current_user_is_not_assigned_to_responsible_client(self):
        create(Builder('org_unit').id('org-unit-2').with_default_groups()
               .having(admin_unit=self.admin_unit))
        task = create(Builder('task')
                      .having(
                          issuer=TEST_USER_ID,
                          responsible=TEST_USER_ID,
                          responsible_client='org-unit-2'))

        validator = MethodValidator(task, self.portal.REQUEST, None,
                                    IChooseMethodSchema['method'], None)

        with self.assertRaises(Invalid):
            validator.validate('existing_dossier')