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(TestStardEndValidator, self).setUp() self.grant('Manager') client = create_client(clientid='Plone') create_ogds_user(TEST_USER_ID, assigned_client=[client, ]) set_current_client_id(self.portal, clientid='Plone')
def setUp(self): super(TestTemplateDossier, self).setUp() client1 = create_client() create_ogds_user(TEST_USER_ID, assigned_client=[client1]) set_current_client_id(self.portal) self.grant('Manager')
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(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()
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(TestSearchFormWithFilingNumberSupport, self).setUp() activate_filing_number(self.portal) create_client() set_current_client_id(self.portal) transaction.commit()
def test_label_for_inboxes_contains_client_title_prefixed_with_inbox(self): set_current_client_id(self.portal) self.portal.REQUEST.set('client', 'client2') self.assertTerms( [('inbox:client2', 'Inbox: Client 2')], self.vocabulary_factory(self.portal))
def setUp(self): super(TestDossierDetailsDossierMetadata, self).setUp() client1 = create_client() create_ogds_user(TEST_USER_ID, assigned_client=[client1], firstname='t\xc3\xa4st'.decode('utf-8'), lastname=u'User') set_current_client_id(self.portal)
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 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)
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 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 setUp(self): super(TestStardEndValidator, self).setUp() self.grant('Manager') client = create_client(clientid='Plone') create_ogds_user(TEST_USER_ID, assigned_client=[ client, ]) set_current_client_id(self.portal, clientid='Plone')
def setUp(self): super(TestTaskRedirector, self).setUp() client = create_client() user = create_ogds_user(TEST_USER_ID) assign_user_to_client(user, client) set_current_client_id(self.portal) self.dossier = create(Builder('dossier'))
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 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_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')())
def test_hidden_terms_contains_all_inactive_users(self): client1 = create_client(clientid="client1", title="Client 1") set_current_client_id(self.portal) create_ogds_user('robin.hood', assigned_client=[client1, ], active=False) create_ogds_user('hans.peter', active=False) vocabulary = self.vocabulary_factory(self.portal) self.assertEquals([u'robin.hood', u'hans.peter'], vocabulary.hidden_terms)
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 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_client_prefix_of_title_is_omitted_in_one_client_setup(self): client1 = create_client(clientid="client1", title="Client 1") create_ogds_user('hugo.boss', firstname='Hugo', lastname='Boss', assigned_client=[client1, ]) set_current_client_id(self.portal) self.assertTerms( [('client1:hugo.boss', 'Boss Hugo (hugo.boss)'), ('client1:inbox:client1', 'Inbox: Client 1')], self.vocabulary_factory(self.portal))
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_client_vocabulary_contains_all_active_clients(self): create_client(clientid='client1') create_client(clientid='client2') create_client(clientid='client3', enabled=False) set_current_client_id(self.portal) voca_factory = getUtility(IVocabularyFactory, name='opengever.ogds.base.ClientsVocabulary') self.assertTermKeys( ['client1', 'client2'], voca_factory(self.portal))
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')())
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)
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))
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_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_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(TestTaskIndexers, self).setUp() self.portal.portal_types['opengever.task.task'].global_allow = True set_current_client_id(self.portal, 'plone') self.grant('Contributor', 'Editor', 'Manager') login(self.portal, TEST_USER_NAME) self.task = create(Builder("task").titled("Test task 1")) self.subtask = create(Builder("task").within(self.task).titled("Test task 1")) self.doc1 = create(Builder("document").titled(u"Doc One")) self.doc2 = create(Builder("document").titled(u"Doc Two"))
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))
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 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_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))
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())
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'))
def setUp(self): super(TestTaskIndexers, self).setUp() self.portal.portal_types['opengever.task.task'].global_allow = True set_current_client_id(self.portal, 'plone') self.grant('Contributor', 'Editor', 'Manager') login(self.portal, TEST_USER_NAME) self.task = create(Builder("task").titled("Test task 1")) self.subtask = create( Builder("task").within(self.task).titled("Test task 1")) self.doc1 = create(Builder("document").titled(u"Doc One")) self.doc2 = create(Builder("document").titled(u"Doc Two"))
def setUp(self): super(TestDocumentListing, self).setUp() create_client() set_current_client_id(self.portal) self.document = create(Builder('document') .having(title=u'Document A', document_date=date(2013, 11, 4), receipt_date=date(2013, 11, 6), document_author='Hugo Boss')) self.listing = getMultiAdapter( (self.document, self.document.REQUEST, self), ILaTexListing, name='documents')
def test_contains_only_users_assigned_to_current_client(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]) create_ogds_user('peter.muster', firstname='Peter', lastname='Muster', assigned_client=[client2]) create_ogds_user('jamie.lannister', firstname='Jamie', lastname='Lannister', assigned_client=[client1, client2]) set_current_client_id(self.portal, clientid='client2') self.assertTermKeys( ['peter.muster', 'jamie.lannister'], self.vocabulary_factory(self.portal))