def test_upload_and_edit(self):
        text = 'This is the sample text'
        newtext = 'This is the edited sample text'
        ct = 'rst'
        rsp = self.app.post(
            '/post', {
                'upload': text,
                'syntax': ct,
            }
        )
        assert rsp.status == '200 OK'
        url = urlparse.urlparse(rsp.body)
        rsp = self.app.get('/raw{0}'.format(url.path.decode(),))
        assert rsp.status == '200 OK'
        assert rsp.body.decode() == text
        # Editing this entry should yield a 200, and pre-filled
        # content should be the same content we submitted the 1st time
        rsp = self.app.get('/edit{0}'.format(url.path.decode(),))
        assert rsp.status == '200 OK'
        assert rsp.form['upload'].value == text
        assert rsp.form['syntax'].value == ct
        # The "edit" page is just a new form page with pre-filled values,
        # it still posts to the main /post endpoint
        rsp = self.app.post(
            '/post', {
                'upload': newtext,
            }
        )
        assert rsp.status == '200 OK'
        url = urlparse.urlparse(rsp.body)
        rsp = self.app.get('/raw{0}'.format(url.path.decode(),))
        assert rsp.status == '200 OK'
        assert rsp.body.decode() == newtext
Upload some text, then edit it, expect a 200 in both cases
dataset/ETHPy150Open thekad/pasttle/tests/suites/functional.py/FunctionalTest.test_upload_and_edit