Ignore:
Timestamp:
21 Nov 2014, 08:07:15 (10 years ago)
Author:
Henrik Bettermann
Message:

Add more browser components for document editing. Editing is allowed only under certain conditions.

  • work in progress -
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12016 r12018  
    107107        # Set password
    108108        IUserAccount(
    109             self.app['customers'][self.customer_id]).setPassword('spwd')
     109            self.app['customers'][self.customer_id]).setPassword('cpwd')
    110110
    111111        self.login_path = 'http://localhost/app/login'
     
    484484        self.browser.open(self.login_path)
    485485        self.browser.getControl(name="form.login").value = self.customer_id
    486         self.browser.getControl(name="form.password").value = 'spwd'
     486        self.browser.getControl(name="form.password").value = 'cpwd'
    487487        self.browser.getControl("Login").click()
    488488        self.assertMatches(
     
    511511        self.browser.open(self.login_path)
    512512        self.browser.getControl(name="form.login").value = self.customer_id
    513         self.browser.getControl(name="form.password").value = 'spwd'
     513        self.browser.getControl(name="form.password").value = 'cpwd'
    514514        self.browser.getControl("Login").click()
    515515        self.assertEqual(self.browser.url, self.customer_path)
     
    554554        self.browser.open(self.login_path)
    555555        self.browser.getControl(name="form.login").value = self.customer_id
    556         self.browser.getControl(name="form.password").value = 'spwd'
     556        self.browser.getControl(name="form.password").value = 'cpwd'
    557557        self.browser.getControl("Login").click()
    558558        self.assertMatches(
     
    575575        self.browser.open(self.login_path)
    576576        self.browser.getControl(name="form.login").value = self.customer_id
    577         self.browser.getControl(name="form.password").value = 'spwd'
     577        self.browser.getControl(name="form.password").value = 'cpwd'
    578578        self.browser.getControl("Login").click()
    579579        self.assertEqual(self.browser.url, self.customer_path)
     
    594594        self.browser.open(self.login_path)
    595595        self.browser.getControl(name="form.login").value = self.customer_id
    596         self.browser.getControl(name="form.password").value = 'spwd'
     596        self.browser.getControl(name="form.password").value = 'cpwd'
    597597        self.browser.getControl("Login").click()
    598598        self.assertTrue(
     
    600600        # We set the password again
    601601        IUserAccount(
    602             self.app['customers'][self.customer_id]).setPassword('spwd')
     602            self.app['customers'][self.customer_id]).setPassword('cpwd')
    603603        # Customers can't login if their account is suspended/deactivated
    604604        self.customer.suspended = True
    605605        self.browser.open(self.login_path)
    606606        self.browser.getControl(name="form.login").value = self.customer_id
    607         self.browser.getControl(name="form.password").value = 'spwd'
     607        self.browser.getControl(name="form.password").value = 'cpwd'
    608608        self.browser.getControl("Login").click()
    609609        self.assertMatches(
     
    613613        self.customer.suspended_comment = u'Aetsch baetsch!'
    614614        self.browser.getControl(name="form.login").value = self.customer_id
    615         self.browser.getControl(name="form.password").value = 'spwd'
     615        self.browser.getControl(name="form.password").value = 'cpwd'
    616616        self.browser.getControl("Login").click()
    617617        self.assertMatches(
     
    622622        # is not expired
    623623        self.app['customers'][self.customer_id].setTempPassword(
    624             'anybody', 'temp_spwd')
    625         self.browser.open(self.login_path)
    626         self.browser.getControl(name="form.login").value = self.customer_id
    627         self.browser.getControl(name="form.password").value = 'spwd'
     624            'anybody', 'temp_cpwd')
     625        self.browser.open(self.login_path)
     626        self.browser.getControl(name="form.login").value = self.customer_id
     627        self.browser.getControl(name="form.password").value = 'cpwd'
    628628        self.browser.getControl("Login").click()
    629629        self.assertMatches(
     
    633633        self.browser.open(self.login_path)
    634634        self.browser.getControl(name="form.login").value = self.customer_id
    635         self.browser.getControl(name="form.password").value = 'temp_spwd'
     635        self.browser.getControl(name="form.password").value = 'temp_cpwd'
    636636        self.browser.getControl("Login").click()
    637637        self.assertMatches(
     
    652652        self.browser.open(self.login_path)
    653653        self.browser.getControl(name="form.login").value = self.customer_id
    654         self.browser.getControl(name="form.password").value = 'spwd'
     654        self.browser.getControl(name="form.password").value = 'cpwd'
    655655        self.browser.getControl("Login").click()
    656656        self.assertMatches(
     
    825825            '- K1000000 - removed: %s'
    826826            % document.document_id in logcontent)
     827
     828    def test_edit_document(self):
     829        # Customers can manage documents under certain conditions
     830        self.browser.open(self.login_path)
     831        self.browser.getControl(name="form.login").value = self.customer_id
     832        self.browser.getControl(name="form.password").value = 'cpwd'
     833        self.browser.getControl("Login").click()
     834        self.assertMatches(
     835            '...You logged in...', self.browser.contents)
     836        self.browser.getLink("Documents").click()
     837        self.browser.getLink("Add document").click()
     838        self.browser.getControl(name="doctype").value = ['generic']
     839        self.browser.getControl("Create document").click()
     840        self.assertTrue('Generic Document created.' in self.browser.contents)
     841        document = self.customer['documents']['d102']
     842
     843        # Document can be edited ...
     844        self.browser.getLink("d102").click()
     845
     846
     847        self.browser.open(self.documents_path + '/d102/edit')
     848        #self.browser.getLink("Edit").click()
     849        self.assertTrue('The requested form is locked' in self.browser.contents)
     850
     851
     852
     853
     854
     855
     856
     857        self.browser.getControl(name="form.title").value = 'My second doc'
     858        self.browser.getControl("Save").click()
     859        self.assertTrue('Form has been saved.' in self.browser.contents)
     860        self.browser.getLink("View").click()
     861        self.assertEqual(self.browser.url, self.documents_path + '/d102/index')
Note: See TracChangeset for help on using the changeset viewer.