예제 #1
0
    def test_task_title_length_is_validated_to_a_max_of_256(self, browser):
        dossier = create(Builder('dossier'))
        browser.login().open(dossier, view='++add++opengever.task.task')

        browser.fill({'Title': 257 * 'x',
                      'Task Type': 'To comment'
                      })

        # Fill Responible manually
        form = browser.find_form_by_field('Responsible')
        form.find_widget('Responsible').fill(
            self.get_org_unit().id() + ':' + TEST_USER_ID)
        browser.find('Save').click()

        self.assertEquals({u'Title': ['Value is too long']},
                          erroneous_fields())

        browser.fill({'Title': 256 * 'x'})

        # We need to fill it again, because of a known bug in lxml
        # https://github.com/4teamwork/ftw.testbrowser/pull/17
        # https://github.com/4teamwork/ftw.testbrowser/issues/53
        form = browser.find_form_by_field('Responsible')
        form.find_widget('Responsible').fill(
            self.get_org_unit().id() + ':' + TEST_USER_ID)

        browser.find('Save').click()
        self.assertTrue(len(dossier.objectValues()),
                        'Expect one item in dossier')
예제 #2
0
 def test_doc_without_either_file_or_paper_form_is_invalid(self, browser):
     browser.login().open(self.doc_without_file.absolute_url() + '/edit')
     # No file, not preserved as paper
     browser.fill({'Preserved as paper': False}).save()
     self.assertEquals(
         erroneous_fields(),
         {'Preserved as paper': [
             "You don't select a file and document is also not preserved"
             " in paper_form, please correct it."]})
예제 #3
0
 def test_doc_without_either_file_or_paper_form_is_invalid(self, browser):
     browser.login().open(self.doc_without_file.absolute_url() + '/edit')
     # No file, not preserved as paper
     browser.fill({'Preserved as paper': False}).save()
     self.assertEquals(
         erroneous_fields(),
         {'Preserved as paper': [
             "You don't select a file and document is also not preserved"
             " in paper_form, please correct it."]})
예제 #4
0
    def test_doc_without_paper_form_and_removing_the_file_is_invalid(self, browser):
        browser.login().open(self.doc_with_file, view='edit')
        browser.fill({'Remove existing file': 'remove',
                      'Preserved as paper': False}).save()

        self.assertEquals(
            erroneous_fields(),
            {'Preserved as paper': [
                "You don't select a file and document is also not preserved"
                " in paper_form, please correct it."]})
예제 #5
0
    def test_doc_without_paper_form_and_removing_the_file_is_invalid(self, browser):
        browser.login().open(self.doc_with_file, view='edit')
        browser.fill({'Remove existing file': 'remove',
                      'Preserved as paper': False}).save()

        self.assertEquals(
            erroneous_fields(),
            {'Preserved as paper': [
                "You don't select a file and document is also not preserved"
                " in paper_form, please correct it."]})
    def test_erroneous_fields(self, browser):
        self.grant('Manager')

        browser.login().open()
        factoriesmenu.add('Folder', browser=browser)
        browser.find('Save').click()

        self.assertEquals(browser.previous_url, browser.url)
        self.assertEquals({u'Title': ['Required input is missing.']},
                          dexterity.erroneous_fields(browser=browser))
예제 #7
0
    def test_task_title_length_is_validated(self, browser):
        dossier = create(Builder('dossier'))
        browser.login().open(dossier, view='++add++opengever.task.task')

        browser.fill({'Title': 300*'x',
                      'Task Type': 'To comment',
                      'Responsible': TEST_USER_ID})
        browser.find('Save').click()

        self.assertEquals({u'Title': ['Value is too long']},
                          erroneous_fields())
예제 #8
0
    def test_doc_without_either_file_or_paper_form_is_invalid(self, browser):
        self.login(self.dossier_responsible, browser)
        browser.open(self.dossier)

        factoriesmenu.add('Document')
        # No file, not preserved as paper
        browser.fill({'Title': 'My Document',
                      'Preserved as paper': False}).save()
        self.assertEquals(
            erroneous_fields(),
            {'Preserved as paper': [
                "You don't select a file and document is also not preserved"
                " in paper_form, please correct it."]})
예제 #9
0
    def test_doc_without_either_file_or_paper_form_is_invalid(self, browser):
        self.login(self.dossier_responsible, browser)
        browser.open(self.dossier)

        factoriesmenu.add('Document')
        # No file, not preserved as paper
        browser.fill({'Title': 'My Document',
                      'Preserved as paper': False}).save()
        self.assertEquals(
            erroneous_fields(),
            {'Preserved as paper': [
                "You don't select a file and document is also not preserved"
                " in paper_form, please correct it."]})
예제 #10
0
 def test_doc_without_either_file_or_paper_form_is_invalid(self, browser):
     browser.login().open(self.dossier.absolute_url())
     factoriesmenu.add("Document")
     # No file, not preserved as paper
     browser.fill({"Title": "My Document", "Preserved as paper": False}).save()
     self.assertEquals(
         erroneous_fields(),
         {
             "Preserved as paper": [
                 "You don't select a file and document is also not preserved" " in paper_form, please correct it."
             ]
         },
     )
    def test_raise_invalid_if_hard_limit_is_not_satisfied_for_height(self, browser):
        page = create(Builder('sl content page'))
        block = create(Builder('sl textblock').within(page).with_dummy_image())

        self.set_config({
            block.portal_type: [
                u'hard: height={}'.format(block.image._height + 100)
            ]}
        )

        browser.login().visit(block, view="edit")
        browser.find_button_by_label('Save').click()

        self.assertEqual(
            [["The image doesn't fit the required dimensions of height: 1180px (current: 1080px)"]],
            erroneous_fields().values())
예제 #12
0
    def test_committee_repository_is_validated(self, browser):
        self.login(self.administrator, browser)

        browser.open(self.committee_container,
                     view='++add++opengever.meeting.committee')

        browser.fill(
            {'Title': u'A c\xf6mmittee',
             'Linked repository folder': self.branch_repofolder,
             self.group_field_name: 'committee_rpk_group'})
        browser.css('#form-buttons-save').first.click()

        self.assertEqual(
            'You cannot add dossiers in the selected repository folder. '
            'Either you do not have the privileges or the repository folder '
            'contains another repository folder.',
            dexterity.erroneous_fields()['Linked repository folder'][0])
예제 #13
0
    def test_committee_repository_is_validated(self, browser):
        self.login(self.administrator, browser)

        browser.open(self.committee_container,
                     view='++add++opengever.meeting.committee')

        browser.fill(
            {'Title': u'A c\xf6mmittee',
             'Linked repository folder': self.branch_repofolder,
             self.group_field_name: 'committee_rpk_group'})
        browser.css('#form-buttons-save').first.click()

        self.assertEqual('You cannot add dossiers in the selected repository '
                         'folder. Either you do not have the privileges or '
                         'the repository folder contains another repository '
                         'folder.',
                         dexterity.erroneous_fields()['fuhrung'][0])
    def test_raise_invalid_on_form_validation_if_hard_limit_is_not_satisfied(self, browser):
        container = create(Builder('sliderblock'))

        pane = create(Builder('slider pane')
                      .titled('Pane')
                      .with_dummy_image()
                      .within(container))

        self.set_image_limit_config({
            pane.portal_type: [
                u'hard: width={}'.format(pane.image._width + 100)
            ]}
        )

        browser.login().visit(pane, view="edit")
        browser.find_button_by_label('Save').click()

        self.assertEqual(
            [["The image doesn't fit the required dimensions of width: 101px (current: 1px)"]],
            erroneous_fields().values())
예제 #15
0
    def test_step3_responsible_fields_are_required(self, browser):
        self.login(self.regular_user, browser=browser)

        self.tasktemplate.responsible = None
        self.tasktemplate.responsible_client = None

        browser.open(self.dossier, view='add-tasktemplate')
        browser.fill({'Tasktemplatefolder': u'Verfahren Neuanstellung'})
        browser.click_on('Continue')
        browser.fill({'Tasktemplates': ['Arbeitsplatz einrichten.']})
        browser.click_on('Continue')

        browser.click_on('Trigger')

        self.assertEquals(
            '{}/select-responsibles'.format(self.dossier.absolute_url()),
            browser.url)

        self.assertEquals(
            {u'Responsible \xabArbeitsplatz einrichten.\xbb': ['Required input is missing.']},
            erroneous_fields())
예제 #16
0
    def test_step3_responsible_fields_are_required(self, browser):
        self.login(self.regular_user, browser=browser)

        self.tasktemplate.responsible = None
        self.tasktemplate.responsible_client = None

        browser.open(self.dossier, view='add-tasktemplate')
        browser.fill({'Tasktemplatefolder': u'Verfahren Neuanstellung'})
        browser.click_on('Continue')
        browser.fill({'Tasktemplates': ['Arbeitsplatz einrichten.']})
        browser.click_on('Continue')

        browser.click_on('Trigger')

        self.assertEquals(
            '{}/select-responsibles'.format(self.dossier.absolute_url()),
            browser.url)

        self.assertEquals(
            {
                u'Responsible \xabArbeitsplatz einrichten.\xbb':
                ['Required input is missing.']
            }, erroneous_fields())
 def test_erroneous_fields(self, browser):
     browser.login().open()
     factoriesmenu.add("Folder")
     browser.find("Save").click()
     self.assertEquals(browser.previous_url, browser.url)
     self.assertEquals({u"Title": ["Required input is missing."]}, dexterity.erroneous_fields())