def test_document_contains_all_documents_of_the_given_remote_dossier(self):

        class ClientCommunicatorMockUtility(communication.ClientCommunicator):

            implements(communication.IClientCommunicator)

            def get_documents_of_dossier(self, target_client_id, dossier_path):
                dossier_url = 'http://nohost/client2/' + dossier_path
                return [{'path': dossier_path + '/document-1',
                         'url': dossier_url + '/document-1',
                         'title': 'First Document',
                         'review_state': 'draft'},
                        {'path': dossier_path + '/document-2',
                         'url': dossier_url + '/document-2',
                         'title': 'Second Document',
                         'review_state': 'draft'}]

        provideUtility(ClientCommunicatorMockUtility())

        create_client(clientid="client1")
        client2 = create_client(clientid="client2")
        create_ogds_user(TEST_USER_ID, assigned_client=[client2])

        self.portal.REQUEST.set('dossier_path', 'op1/op2/dossier2')
        self.portal.REQUEST.set('client', 'client2')

        voca_factory = getUtility(
            IVocabularyFactory,
            name='opengever.ogds.base.DocumentInSelectedDossierVocabulary')

        self.assertTerms(
            [('op1/op2/dossier2/document-1', 'First Document'),
             ('op1/op2/dossier2/document-2', 'Second Document')],
            voca_factory(self.portal))
    def test_view(self):
        portal = self.layer['portal']

        create_client('plone')
        set_current_client_id(portal, 'plone')
        self.grant('Manager')

        # Folders and templates
        template_folder_1 = create_testobject(
            portal,
            'opengever.tasktemplates.tasktemplatefolder',
            title='TaskTemplateFolder 1')

        template1 = create_testobject(
            template_folder_1,
            'opengever.tasktemplates.tasktemplate',
            title='TaskTemplate 1',
            text='Test Text',
            preselected=True,
            task_type='unidirectional_by_value',
            issuer='responsible',
            responsible_client='interactive_users',
            deadline=7,
            responsible='current_user', )
        transaction.commit()

        self.browser.open('%s' % template1.absolute_url())
        heading = self.browser.locate(".documentFirstHeading")
        self.assertEquals('TaskTemplate 1', heading.plain_text())
Example #3
0
    def test_view(self):
        portal = self.layer['portal']

        create_client('plone')
        set_current_client_id(portal, 'plone')
        self.grant('Manager')

        # Folders and templates
        template_folder_1 = create_testobject(
            portal,
            'opengever.tasktemplates.tasktemplatefolder',
            title='TaskTemplateFolder 1')

        template1 = create_testobject(
            template_folder_1,
            'opengever.tasktemplates.tasktemplate',
            title='TaskTemplate 1',
            text='Test Text',
            preselected=True,
            task_type='unidirectional_by_value',
            issuer='responsible',
            responsible_client='interactive_users',
            deadline=7,
            responsible='current_user',
        )
        transaction.commit()

        self.browser.open('%s' % template1.absolute_url())
        heading = self.browser.locate(".documentFirstHeading")
        self.assertEquals('TaskTemplate 1', heading.plain_text())
    def setUp(self):
        super(TestGroupHelpers, self).setUp()
        self.info = getUtility(IContactInformation)

        self.client1 = create_client(clientid='client1')
        self.client2 = create_client(clientid='client2')
        set_current_client_id(self.portal)
    def setUp(self):
        super(TestSendDocument, self).setUp()
        self.grant('Member', 'Contributor', 'Manager')

        create_client('plone')
        set_current_client_id(self.portal, clientid=u'plone')
        Mailing(self.portal).set_up()
    def setUp(self):
        super(TestGroupHelpers, self).setUp()
        self.info = getUtility(IContactInformation)

        self.client1 = create_client(clientid='client1')
        self.client2 = create_client(clientid='client2')
        set_current_client_id(self.portal)
    def test_home_dossier_vocabulary_contains_all_open_dossier_from_your_home_client(self):

        class ClientCommunicatorMockUtility(communication.ClientCommunicator):
            implements(communication.IClientCommunicator)

            def get_open_dossiers(self, target_client_id):
                return [{'url': 'http://nohost/client2/op1/op2/dossier1',
                         'path': 'op1/op2/dossier1',
                         'title': 'Dossier 1',
                         'workflow_state': 'dossier-state-active',
                         'reference_number': 'OG 1.2 / 1'},
                        {'url': 'http://nohost/client2/op1/op2/dossier2',
                         'path': 'op1/op2/dossier2',
                         'title': 'Dossier 2',
                         'workflow_state': 'dossier-state-active',
                         'reference_number': 'OG 1.2 / 2'}]

        provideUtility(ClientCommunicatorMockUtility())

        create_client(clientid="client1")
        client2 = create_client(clientid="client2")
        create_ogds_user(TEST_USER_ID, assigned_client=[client2])

        self.portal.REQUEST.set('client', 'client2')

        voca_factory = getUtility(
            IVocabularyFactory,
            name='opengever.ogds.base.HomeDossiersVocabulary')

        self.assertTerms(
            [('op1/op2/dossier1', 'OG 1.2 / 1: Dossier 1'),
             ('op1/op2/dossier2', 'OG 1.2 / 2: Dossier 2')],
            voca_factory(self.portal))
Example #8
0
    def test_credentials_authentication_from_a_not_existig_client_returns_none(self):
        create_client('client1', ip_address='192.186.1.1')

        self.set_params_for_remote_request(clientid='client3', client_ip='192.168.1.1')

        creds = extract_user(self.portal, self.portal.REQUEST)
        self.assertEquals(None, authenticate_credentials(self.portal, creds))
Example #9
0
    def test_credentials_authentication_for_invalid_ip_returns_none(self):
        create_client('client1', ip_address='192.186.1.1')

        self.set_params_for_remote_request(client_ip='192.168.1.233')

        creds = extract_user(self.portal, self.portal.REQUEST)
        self.assertEquals(None, authenticate_credentials(self.portal, creds))
Example #10
0
    def setUp(self):
        super(TestInboxOverviewAssignedInboxTasks, self).setUp()

        create_client('client1')
        create_client('client2')
        set_current_client_id(self.portal, 'client1')

        create_ogds_user(TEST_USER_NAME)
    def setUp(self):
        super(TestClientHelpers, self).setUp()
        self.info = getUtility(IContactInformation)

        self.client1 = create_client(clientid='client1')
        self.client2 = create_client(clientid='client2')
        create_client(clientid='client3', enabled=False)
        set_current_client_id(self.portal, clientid='client1')
    def setUp(self):
        super(TestSendDocument, self).setUp()
        self.grant('Member', 'Contributor', 'Manager')

        create_client('plone')
        set_current_client_id(self.portal, clientid=u'plone')
        create_ogds_user(TEST_USER_ID)
        Mailing(self.portal).set_up()
Example #13
0
    def setUp(self):
        super(TestInboxOverviewAssignedInboxTasks, self).setUp()

        create_client('client1')
        create_client('client2')
        set_current_client_id(self.portal, 'client1')

        create_ogds_user(TEST_USER_NAME)
    def setUp(self):
        super(TestUsersAndInboxesVocabulary, self).setUp()
        self.vocabulary_factory = getUtility(
            IVocabularyFactory,
            name='opengever.ogds.base.UsersAndInboxesVocabulary')

        self.client1 = create_client(clientid="client1", title="Client 1")
        self.client2 = create_client(clientid="client2", title="Client 2")
Example #15
0
    def setUp(self):

        super(TestSearchFormWithFilingNumberSupport, self).setUp()
        activate_filing_number(self.portal)

        create_client()
        set_current_client_id(self.portal)
        transaction.commit()
    def setUp(self):
        super(TestClientHelpers, self).setUp()
        self.info = getUtility(IContactInformation)

        self.client1 = create_client(clientid='client1')
        self.client2 = create_client(clientid='client2')
        create_client(clientid='client3', enabled=False)
        set_current_client_id(self.portal, clientid='client1')
Example #17
0
    def setUp(self):

        super(TestSearchFormWithFilingNumberSupport, self).setUp()
        activate_filing_number(self.portal)

        create_client()
        set_current_client_id(self.portal)
        transaction.commit()
    def test_exclude_inactive_clients_inboxes(self):
        create_client(clientid="client1", title="Client 1")
        create_client(clientid="client2", title="Client 2", enabled=False)
        set_current_client_id(self.portal)

        vocabulary = self.vocabulary_factory(self.portal)

        self.assertNotInTerms('client2:inbox', vocabulary)
        self.assertInTerms('client1:inbox:client1', vocabulary)
Example #19
0
    def setUp(self):
        super(TestSearchWithContent, self).setUp()

        create_client()
        set_current_client_id(self.layer['portal'])
        create_ogds_user(TEST_USER_ID)

        self.dossier1 = create(Builder("dossier").titled(u"Dossier1"))
        self.dossier2 = create(Builder("dossier").titled(u"Dossier2"))
    def test_describing_inboxes(self):
        create_client(clientid='client1', title='Client 1')

        self.assertEquals(u'Inbox: Client 1',
                          self.info.describe(u'inbox:client1'))

        self.assertEquals(
            u'Inbox: Client 1',
            self.info.describe(u'inbox:client1', with_principal=False))
Example #21
0
    def setUp(self):
        super(TestSearchWithContent, self).setUp()

        create_client()
        set_current_client_id(self.layer['portal'])
        create_ogds_user(TEST_USER_ID)

        self.dossier1 = create(Builder("dossier").titled(u"Dossier1"))
        self.dossier2 = create(Builder("dossier").titled(u"Dossier2"))
Example #22
0
    def setUp(self):
        super(TestResponse, self).setUp()
        self.portal.portal_types['opengever.task.task'].global_allow = True

        session = create_session()
        create_client('plone',
                      group='og_mandant1_users',
                      inbox_group='og_mandant1_inbox',
                      session=session)
        create_client('client2',
                      group='og_mandant2_users',
                      inbox_group='og_mandant2_inbox',
                      session=session)
        set_current_client_id(self.portal, 'plone')

        create_ogds_user(TEST_USER_ID,
                         groups=('og_mandant1_users', 'og_mandant1_inbox',
                                 'og_mandant2_users'),
                         firstname='Test',
                         lastname='User',
                         session=session)

        create_plone_user(self.portal, 'testuser2')
        create_ogds_user('testuser2',
                         groups=('og_mandant2_users', 'og_mandant2_inbox'),
                         firstname='Test',
                         lastname='User 2',
                         session=session)

        self.grant('Contributor', 'Editor')
        login(self.portal, TEST_USER_NAME)

        self.dossier = create(Builder("dossier"))

        self.task = create(
            Builder('task').within(self.dossier).having(
                title="Test task 1",
                issuer=TEST_USER_ID,
                text=u'',
                responsible='testuser2',
                responsible_client='client2',
                task_type="direct-execution"))

        self.successor = create(
            Builder('task').within(self.dossier).having(
                title="Test task 1",
                responsible='testuser2',
                issuer=TEST_USER_ID,
                text=u'',
                task_type="direct-execution",
                responsible_client='client2'))

        self.doc1 = create(
            Builder("document").within(self.dossier).titled("Doc 1"))
        self.doc2 = create(
            Builder("document").within(self.dossier).titled("Doc 2"))
        transaction.commit()
Example #23
0
    def setUp(self):
        super(TestResponse, self).setUp()
        self.portal.portal_types['opengever.task.task'].global_allow = True

        session = create_session()
        create_client('plone', group='og_mandant1_users',
                      inbox_group='og_mandant1_inbox', session=session)
        create_client('client2', group='og_mandant2_users',
                      inbox_group='og_mandant2_inbox', session=session)
        set_current_client_id(self.portal, 'plone')

        create_ogds_user(TEST_USER_ID,
                         groups=('og_mandant1_users',
                                 'og_mandant1_inbox',
                                 'og_mandant2_users'),
                         firstname='Test',
                         lastname='User',
                         session=session)

        create_plone_user(self.portal, 'testuser2')
        create_ogds_user('testuser2',
                         groups=('og_mandant2_users', 'og_mandant2_inbox'),
                         firstname='Test',
                         lastname='User 2',
                         session=session)

        self.grant('Contributor', 'Editor')
        login(self.portal, TEST_USER_NAME)

        self.dossier = create(Builder("dossier"))

        self.task = create(Builder('task')
                           .within(self.dossier)
                           .having(title="Test task 1",
                                   issuer=TEST_USER_ID,
                                   text=u'',
                                   responsible='testuser2',
                                   responsible_client='client2',
                                   task_type="direct-execution"))

        self.successor = create(Builder('task')
                                .within(self.dossier)
                                .having(title="Test task 1",
                                        responsible='testuser2',
                                        issuer=TEST_USER_ID,
                                        text=u'',
                                        task_type="direct-execution",
                                        responsible_client='client2'))

        self.doc1 = create(Builder("document")
                           .within(self.dossier)
                           .titled("Doc 1"))
        self.doc2 = create(Builder("document")
                           .within(self.dossier)
                           .titled("Doc 2"))
        transaction.commit()
    def test_modify_is_allowed_for_issuer_on_a_in_progress_task(self):
        create_client()
        set_current_client_id(self.portal)

        task = create(
            Builder('task').having(issuer=TEST_USER_ID,
                                   responsible=TEST_USER_ID).in_progress())

        self.assertTrue(
            task.restrictedTraverse('is_deadline_modification_allowed')())
Example #25
0
    def setUp(self):
        super(TestSearchWithoutContent, self).setUp()

        activate_filing_number(self.portal)

        create_client()
        set_current_client_id(self.layer['portal'])
        create_ogds_user(TEST_USER_ID)

        self.dossier1 = create(Builder("dossier"))
    def test_describing_inboxes(self):
        create_client(clientid='client1', title='Client 1')

        self.assertEquals(
            u'Inbox: Client 1',
            self.info.describe(u'inbox:client1'))

        self.assertEquals(
            u'Inbox: Client 1',
            self.info.describe(u'inbox:client1', with_principal=False))
Example #27
0
    def setUp(self):
        super(TestSearchWithoutContent, self).setUp()

        activate_filing_number(self.portal)

        create_client()
        set_current_client_id(self.layer['portal'])
        create_ogds_user(TEST_USER_ID)

        self.dossier1 = create(Builder("dossier"))
    def setUp(self):
        super(TestAutoCompleteWidget, self).setUp()
        self.grant('Member', 'Manager')
        self.widget = AutocompleteFieldWidget(
            ITask['issuer'], self.portal.REQUEST)

        create_client(clientid='client1')
        create_ogds_user('hugo.boss')
        create_ogds_user('franz.michel')
        set_current_client_id(self.portal)
    def test_contains_all_users_from_every_client(self):
        client1 = create_client(clientid="client1")
        client2 = create_client(clientid="client2")
        create_ogds_user('hugo.boss', assigned_client=[client1, ])
        create_ogds_user('robin.hood', assigned_client=[client2, ])

        vocabulary = self.vocabulary_factory(self.portal)

        self.assertInTerms('hugo.boss', vocabulary)
        self.assertInTerms('robin.hood', vocabulary)
Example #30
0
    def setUp(self):
        super(TestAutoCompleteWidget, self).setUp()
        self.grant('Member', 'Manager')
        self.widget = AutocompleteFieldWidget(ITask['issuer'],
                                              self.portal.REQUEST)

        create_client(clientid='client1')
        create_ogds_user('hugo.boss')
        create_ogds_user('franz.michel')
        set_current_client_id(self.portal)
    def test_modify_is_allowed_for_issuer_on_a_in_progress_task(self):
        create_client()
        set_current_client_id(self.portal)

        task = create(Builder('task')
                      .having(issuer=TEST_USER_ID, responsible=TEST_USER_ID)
                      .in_progress())

        self.assertTrue(
            task.restrictedTraverse('is_deadline_modification_allowed')())
    def test_modify_is_allowed_for_a_inbox_group_user_when_inbox_is_issuer(self):
        create_client(clientid='client1')
        create_ogds_user(TEST_USER_ID, groups=('client1_inbox_users', ))
        set_current_client_id(self.portal)
        task = create(Builder('task')
                      .having(issuer='inbox:client1', responsible=TEST_USER_ID)
                      .in_progress())

        self.assertTrue(
            task.restrictedTraverse('is_deadline_modification_allowed')())
Example #33
0
    def test_after_successfully_credentials_authentication_the_request_provides_the_internal_request_layer(self):
        client_ip = '192.168.1.233'
        create_client('client1', ip_address=client_ip)
        self.set_params_for_remote_request(client_ip=client_ip)

        creds = extract_user(self.portal, self.portal.REQUEST)
        authenticate_credentials(self.portal, creds)

        self.assertTrue(
            IInternalOpengeverRequestLayer.providedBy(self.portal.REQUEST))
    def test_modify_is_allowed_for_a_inbox_group_user_when_inbox_is_issuer(
            self):
        create_client(clientid='client1')
        create_ogds_user(TEST_USER_ID, groups=('client1_inbox_users', ))
        set_current_client_id(self.portal)
        task = create(
            Builder('task').having(issuer='inbox:client1',
                                   responsible=TEST_USER_ID).in_progress())

        self.assertTrue(
            task.restrictedTraverse('is_deadline_modification_allowed')())
Example #35
0
    def test_after_successfully_credentials_authentication_the_request_provides_the_internal_request_layer(
            self):
        client_ip = '192.168.1.233'
        create_client('client1', ip_address=client_ip)
        self.set_params_for_remote_request(client_ip=client_ip)

        creds = extract_user(self.portal, self.portal.REQUEST)
        authenticate_credentials(self.portal, creds)

        self.assertTrue(
            IInternalOpengeverRequestLayer.providedBy(self.portal.REQUEST))
    def test_include_multiple_terms_for_users_assigned_to_multiple_clients(self):
        client1 = create_client(clientid="client1", title="Client 1")
        client2 = create_client(clientid="client2", title="Client 2")
        create_ogds_user('hugo.boss', firstname='Hugo',
                         lastname='Boss', assigned_client=[client1, client2])
        set_current_client_id(self.portal)

        vocabulary = self.vocabulary_factory(self.portal)

        self.assertInTerms('client1:hugo.boss', vocabulary)
        self.assertInTerms('client2:hugo.boss', vocabulary)
Example #37
0
    def test_credentials_authentication_works_also_with_a_coma_sepereted_list(self):
        """The plugin should also work with a client with a comma
        seperated list of ip_adresses. """

        create_client('client1', ip_address='192.168.1.53,192.168.1.2')

        self.set_params_for_remote_request(client_ip='192.168.1.2')

        creds = extract_user(self.portal, self.portal.REQUEST)
        self.assertEquals(
            ('hugo.boss', 'hugo.boss'),
            authenticate_credentials(self.portal, creds))
Example #38
0
    def test_not_contains_client_info_in_a_single_client_setup(self):
        create_client()
        set_current_client_id(self.portal)
        create_ogds_user(TEST_USER_ID)
        transaction.commit()

        self.browser.open('%s/advanced_search' % self.portal.absolute_url())

        formhelp = self.browser.css(
            '#formfield-form-widgets-object_provides span.formHelp')[0]
        self.assertEquals('Select the contenttype to be searched for.',
                          formhelp.plain_text())
    def test_terms_are_marked_with_client_prefix_in_a_multiclient_setup(self):
        client1 = create_client(clientid="client1", title="Client 1")
        create_client(clientid="client2", title="Client 2")
        create_ogds_user('hugo.boss', firstname='Hugo',
                         lastname='Boss', assigned_client=[client1, ])
        set_current_client_id(self.portal)

        self.assertTerms(
            [('client1:hugo.boss', 'Client 1: Boss Hugo (hugo.boss)'),
            ('client1:inbox:client1', 'Inbox: Client 1'),
            ('client2:inbox:client2', 'Inbox: Client 2')],
            self.vocabulary_factory(self.portal))
Example #40
0
    def test_credentials_authentication_works_also_with_a_coma_sepereted_list(
            self):
        """The plugin should also work with a client with a comma
        seperated list of ip_adresses. """

        create_client('client1', ip_address='192.168.1.53,192.168.1.2')

        self.set_params_for_remote_request(client_ip='192.168.1.2')

        creds = extract_user(self.portal, self.portal.REQUEST)
        self.assertEquals(('hugo.boss', 'hugo.boss'),
                          authenticate_credentials(self.portal, creds))
Example #41
0
    def test_not_contains_client_info_in_a_single_client_setup(self):
        create_client()
        set_current_client_id(self.portal)
        create_ogds_user(TEST_USER_ID)
        transaction.commit()

        self.browser.open('%s/advanced_search' % self.portal.absolute_url())

        formhelp = self.browser.css(
            '#formfield-form-widgets-object_provides span.formHelp')[0]
        self.assertEquals(
            'Select the contenttype to be searched for.',
            formhelp.plain_text())
Example #42
0
    def setUp(self):
        super(TestRefuseForwardingStoring, self).setUp()
        create_client()
        create_client(clientid='client2')
        set_current_client_id(self.portal)

        self.inbox = create(Builder('inbox'))
        self.forwarding = create(Builder('forwarding')
                                 .within(self.inbox)
                                 .having(
                                     title=u'Test forwarding',
                                     responsible_client=u'client2',
                                     responsible=u'inbox:client2'))
    def test_contains_all_local_contacts(self):
        create_client(clientid="client1")
        create(Builder('contact')
               .having(firstname=u'Lara', lastname=u'Croft',
                       email=u'*****@*****.**'))
        create(Builder('contact')
               .having(firstname=u'Super', lastname=u'M\xe4n',
                       email= '*****@*****.**'))

        vocabulary = self.vocabulary_factory(self.portal)

        self.assertInTerms('contact:croft-lara', vocabulary)
        self.assertInTerms('contact:man-super', vocabulary)
    def test_contains_all_clients_assigned_to_the_current_client(self):
        client1 = create_client(clientid='client1')
        set_current_client_id(self.portal, clientid=u'client1')
        create_client(clientid='client2')
        client3 = create_client(clientid='client3')
        create_ogds_user(TEST_USER_ID, assigned_client=[client1, client3])

        voca_factory = getUtility(
            IVocabularyFactory,
            name='opengever.ogds.base.AssignedClientsVocabulary')

        self.assertTermKeys(
            ['client1', 'client3'], voca_factory(self.portal))
    def test_deadline_is_updated_also_in_globalindex(self):
        create_client()
        set_current_client_id(self.portal)
        task = create(Builder('task')
                      .having(issuer=TEST_USER_ID, deadline=datetime.date(2013, 1, 1)))

        self._change_deadline(task, datetime.date(2013, 10, 1), '')

        query = getUtility(ITaskQuery)
        intids = getUtility(IIntIds)

        sql_task = query.get_task(intids.getId(task), 'client1')
        self.assertEquals(sql_task.deadline, datetime.date(2013, 10, 1))
Example #46
0
    def test_lists_only_tasks_assigned_to_current_inbox_group(self):
        create_client(clientid='client2')
        assigned_to_inbox_client1 = create(Builder('forwarding')
                            .within(self.inbox)
                            .having(responsible='inbox:client1'))

        create(Builder('forwarding')
                    .within(self.inbox)
                    .having(responsible='inbox:client2'))

        self.assert_listing_results(
            'assigned_inbox_tasks',
            [assigned_to_inbox_client1, ])
    def test_other_assigned_vocabulary_does_not_include_the_current_client(self):
        client1 = create_client(clientid='client1')
        create_client(clientid='client2')
        client3 = create_client(clientid='client3')

        create_ogds_user(TEST_USER_ID, assigned_client=[client1, client3])
        set_current_client_id(self.portal)

        voca_factory = getUtility(
            IVocabularyFactory,
            name='opengever.ogds.base.OtherAssignedClientsVocabulary')

        self.assertTermKeys(['client3'], voca_factory(self.portal))
    def setUp(self):
        super(TestAssingForwarding, self).setUp()

        create_client()
        create_client(clientid='client2')
        create_ogds_user(TEST_USER_ID, groups=['client1_inbox_users', ])
        set_current_client_id(self.portal)

        self.forwarding = create(
            Builder('forwarding')
            .having(title=u'Test forwarding',
                    responsible_client=u'client1',
                    responsible=u'inbox:client1')
            .in_state('forwarding-state-refused'))
Example #49
0
    def test_contains_special_info_in_a_multi_client_setup(self):
        create_client()
        create_client(clientid="client2")
        set_current_client_id(self.portal)
        transaction.commit()

        self.browser.open('%s/advanced_search' % self.portal.absolute_url())

        formhelp = self.browser.css(
            '#formfield-form-widgets-object_provides span.formHelp')[0]
        self.assertEquals(
            'Select the contenttype to be searched for.'
            'It searches only items from the current client.',
            formhelp.plain_text())