def test_has_an_entry_for_each_mail_address(self): create_ogds_user('hugo.boss', firstname=u'Hugo', lastname=u'Boss', email='*****@*****.**', email2='*****@*****.**') self.assertTermKeys( ['[email protected]:hugo.boss', '[email protected]:hugo.boss'], self.vocabulary_factory(self.portal))
def test_contains_emails_for_all_users(self): create_ogds_user('hugo.boss', firstname=u'Hugo', lastname=u'Boss', email='*****@*****.**') create_ogds_user('robin.hood', firstname=u'Robin', lastname=u'Hood', email='*****@*****.**') self.assertTermKeys( ['[email protected]:hugo.boss', u'[email protected]:robin.hood'], self.vocabulary_factory(self.portal))
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_user_is_assigned_to_client_if_he_is_in_the_client_users_group(self): create_ogds_user('hugo.boss', groups=('client1_users', )) self.assertFalse( self.info.is_client_assigned(userid='hugo.boss', client_id='client2')) self.assertTrue( self.info.is_client_assigned(userid='hugo.boss', client_id='client1'))
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 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))
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 test_render_link_returns_user_details_link(self): create_ogds_user('hugo.boss', **{'firstname': 'Hugo', 'lastname': 'Boss', }) self.assertEquals( u'<a href="http://nohost/plone/@@user-details/hugo.boss">Boss Hugo (hugo.boss)</a>', self.info.render_link('hugo.boss'))
def test_adding_document_with_a_userid_as_author_resolves_to_fullname(self): create_ogds_user('hugo.boss', firstname='Hugo', lastname='Boss') document = create(Builder('document') .having(document_author='hugo.boss') .with_dummy_content()) self.assertEquals('Boss Hugo', document.document_author) self.assertEquals('Boss Hugo', obj2brain(document).document_author)
def setUp(self): super(TestDocumentByline, self).setUp() create_ogds_user('hugo.boss') self.document = create(Builder('document') .having(start=date(2013, 11, 6), document_date=date(2013, 11, 5), document_author='hugo.boss'))
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(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 test_list_users_group_returns_a_list_of_all_group_ids_the_user_is_assigned( self): create_ogds_user('hugo.boss', groups=('client1_users', 'client1_inbox_users')) self.assertEquals(['client1_users', 'client1_inbox_users'], [ group.groupid for group in self.info.list_user_groups('hugo.boss') ])
def test_hide_inactive_users(self): create_ogds_user('robin.hood', active=False) vocabulary = self.vocabulary_factory(self.portal) self.assertTerms([], vocabulary) self.assertEquals(['robin.hood'], vocabulary.hidden_terms) self.assertEquals('Boss Hugo (robin.hood)', vocabulary.getTerm('robin.hood').title)
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 test_inactive_users_are_still_accessible_by_get_term(self): create_ogds_user('robin.hood', firstname='Robin', lastname='Hood', active=False) vocabulary = self.vocabulary_factory(self.portal) self.assertEquals( u'Hood Robin (robin.hood)', vocabulary.getTerm('robin.hood').title)
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(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(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 test_render_link_returns_user_details_link(self): create_ogds_user('hugo.boss', **{ 'firstname': 'Hugo', 'lastname': 'Boss', }) self.assertEquals( u'<a href="http://nohost/plone/@@user-details/hugo.boss">Boss Hugo (hugo.boss)</a>', self.info.render_link('hugo.boss'))
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_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 test_user_is_assigned_to_client_if_he_is_in_the_client_users_group( self): create_ogds_user('hugo.boss', groups=('client1_users', )) self.assertFalse( self.info.is_client_assigned(userid='hugo.boss', client_id='client2')) self.assertTrue( self.info.is_client_assigned(userid='hugo.boss', client_id='client1'))
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_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)
def test_user_details(self, browser): create_ogds_user('hugo.boss', lastname='Boss', firstname='Hugo', groups=('group_a', 'group_b')) browser.open(self.portal, view='@@user-details/hugo.boss') self.assertEquals(['Boss Hugo (hugo.boss)'], browser.css('h1.documentFirstHeading').text) self.assertEquals(['group_a', 'group_b'], browser.css('.groups a').text)
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(TestRepositoryfolderByline, self).setUp() self.intids = getUtility(IIntIds) create_ogds_user('hugo.boss') self.repo = create(Builder('repository') .in_state('repositoryfolder-state-active') .having(privacy_layer=PRIVACY_LAYER_NO))
def test_editing_document_with_a_userid_as_author_resolves_to_fullname(self, browser): create_ogds_user("hugo.boss", firstname="Hugo", lastname="Boss") document = create(Builder("document").having(document_author="hanspeter").with_dummy_content()) browser.login().open(document, view="edit") browser.fill({"Author": u"hugo.boss"}) browser.click_on("Save") self.assertEquals("Boss Hugo", document.document_author) self.assertEquals("Boss Hugo", obj2brain(document).document_author)
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 setUp(self): super(TestMailByline, self).setUp() self.grant('Manager') self.intids = getUtility(IIntIds) create_ogds_user('hugo.boss') self.mail = create(Builder('mail')) self.browser.open(self.mail.absolute_url())
def test_get_email_for_a_user_return_his_first_email(self): create_ogds_user('hugo.boss', **{'firstname': 'Hugo', 'lastname': 'Boss', 'email': '*****@*****.**', 'email2': '*****@*****.**'}) self.assertEquals(u'*****@*****.**', self.info.get_email('hugo.boss')) self.assertEquals(u'*****@*****.**', self.info.get_email(self.info.get_user('hugo.boss')))
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_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_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 setUp(self): super(TestDocumentOverview, self).setUp() self.portal = self.layer['portal'] setRoles(self.portal, TEST_USER_ID, ['Manager']) create_ogds_user(TEST_USER_ID) # Create a second user to test locking and checkout self.portal.acl_users.userFolderAddUser('other_user', 'secret', ['Member'], []) self.browser = Browser(self.layer['app']) self.browser.handleErrors = False self.browser.addHeader( 'Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD)) # document 1 login(self.portal, TEST_USER_NAME) self.portal.invokeFactory('opengever.document.document', 'document-xy', title=u'document') self.document = self.portal.get('document-xy') self._set_default_values(self.document) # document2 (checked out by TEST_USER_ID) self.portal.invokeFactory('opengever.document.document', 'document-2', title=u'document2') self.document2 = self.portal.get('document-2') self._set_default_values(self.document2) manager = queryMultiAdapter((self.document2, self.portal.REQUEST), ICheckinCheckoutManager) manager.checkout() # document3 (checked out by hugo.boss) self.portal.invokeFactory('opengever.document.document', 'document-3', title=u'document3') self.document3 = self.portal.get('document-3') self._set_default_values(self.document3) IAnnotations( self.document3)[CHECKIN_CHECKOUT_ANNOTATIONS_KEY] = 'hugo.boss' # document4 (will later be locked by hugo.boss) self.portal.invokeFactory('opengever.document.document', 'document-4', title=u'document4') self.document4 = self.portal.get('document-4') self._set_default_values(self.document4) transaction.commit()
def test_get_assigned_clients_returns_all_clients_wich_the_users_is_in_the_clients_usergroup(self): create_ogds_user('hugo.boss', groups=('client1_users', )) create_ogds_user('jamie.lannister', groups=('client1_users', 'client2_users')) self.assertEquals( [self.client1, ], self.info.get_assigned_clients(userid='hugo.boss')) self.assertEquals( [self.client1, self.client2], self.info.get_assigned_clients(userid='jamie.lannister'))
def setUp(self): super(TestFilingBusinessCaseByline, self).setUp() activate_filing_number(self.portal) create_ogds_user('hugo.boss') self.dossier = create( Builder('dossier').in_state('dossier-state-active').having( reference_number_prefix='5', responsible='hugo.boss', start=date(2013, 11, 6), end=date(2013, 11, 7), filing_no='OG-Amt-2013-5'))
def setUp(self): super(TestDossierByline, self).setUp() self.intids = getUtility(IIntIds) create_ogds_user('hugo.boss') self.dossier = self.create_dossier() registry = getUtility(IRegistry) mail_settings = registry.forInterface(IMailSettings) mail_settings.mail_domain = u'opengever.4teamwork.ch' transaction.commit()
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 setUp(self): super(TestDocumentByline, self).setUp() self.intids = getUtility(IIntIds) create_ogds_user('hugo.boss') self.document = create( Builder('document').having(start=date(2013, 11, 6), document_date=date(2013, 11, 5))) self.browser.open(self.document.absolute_url())
def test_editing_document_with_a_userid_as_author_resolves_to_fullname(self, browser): create_ogds_user('hugo.boss', firstname='Hugo', lastname='Boss') document = create(Builder('document') .having(document_author='hanspeter') .with_dummy_content()) browser.login().open(document, view='edit') browser.fill({'Author': u'hugo.boss'}) browser.click_on('Save') self.assertEquals('Boss Hugo', document.document_author) self.assertEquals('Boss Hugo', obj2brain(document).document_author)