Ejemplo n.º 1
0
    def run(self):
        user = POOL.checkout()
        user.ensure_logged_in()
        br = user.br

        # Open up comment page
        posting = THREAD
        rval = THREAD.split('/')[4]
        r = br.open(posting)
        r.read()
        assert (r.code == 200), 'Bad HTTP Response'

        br.select_form(nr=0)
        uh = br.form['uh']

        # pick a random comment by finding its form -- XXX thread must have ~ 100 comments
        thing_id = None
        tries = 0
        while not thing_id:
            c_num = random.randint(10,90)
            try:
                br.select_form(nr=c_num)
                thing_id = br.form['thing_id']
            except Exception, e:
                # didn't actually find a comment; try again
                if tries > 5:
                    user.checkin()
                    return
                else:
                    tries += 1
                continue
Ejemplo n.º 2
0
    def run(self):
        user = POOL.checkout()
        user.ensure_logged_in()
        br = user.br

        # Open up comment page
        posting = THREAD
        rval = THREAD.split('/')[4]
        r = br.open(posting)
        r.read()
        assert (r.code == 200), 'Bad HTTP Response'

        br.select_form(nr=0)
        uh = br.form['uh']

        # pick a random comment by finding its form -- XXX thread must have ~ 100 comments
        thing_id = None
        tries = 0
        while not thing_id:
            c_num = random.randint(10, 90)
            try:
                br.select_form(nr=c_num)
                thing_id = br.form['thing_id']
            except Exception, e:
                # didn't actually find a comment; try again
                if tries > 5:
                    user.checkin()
                    return
                else:
                    tries += 1
                continue
Ejemplo n.º 3
0
    def run(self):
        user = POOL.checkout()
        user.ensure_logged_in()
        br = user.br

        # go to comment page
        posting = THREAD
        rval = THREAD.split('/')[4]
        r = br.open(posting)
        r.read()
        assert (r.code == 200), 'Bad HTTP Response'

        # get 'uh' value necessary for commenting
        br.select_form(nr=0)
        uh = br.form['uh']

        # select comment form
        br.select_form(nr=12)
        thing_id = br.form['thing_id']
        id = '#' + br.form.attrs['id']

        data = {'uh':uh, 'thing_id':thing_id, 'id':id, 'renderstyle':'html', 'r':rval, 'text':"This is such an interesting comment!  Upboat me! x"}
        new_data_dict = dict((k, urllib.quote(v).replace('%20', '+')) for k, v in data.iteritems())
        new_data = 'thing_id=%(thing_id)s&text=%(text)s&id=%(id)s&r=%(r)s&uh=%(uh)s&renderstyle=%(renderstyle)s' %(new_data_dict)

        # submit comment
        r = br.open(BASE_URL + '/api/comment', new_data)
        r.read()
        assert (r.code == 200), 'Bad HTTP Response'

        user.checkin()
Ejemplo n.º 4
0
    def run(self):
        user = POOL.checkout()
        user.ensure_logged_in()
        br = user.br

        # go to comment page
        posting = THREAD
        rval = THREAD.split('/')[4]
        r = br.open(posting)
        r.read()
        assert (r.code == 200), 'Bad HTTP Response'

        # get 'uh' value necessary for commenting
        br.select_form(nr=0)
        uh = br.form['uh']

        # select comment form
        br.select_form(nr=12)
        thing_id = br.form['thing_id']
        id = '#' + br.form.attrs['id']

        data = {
            'uh': uh,
            'thing_id': thing_id,
            'id': id,
            'renderstyle': 'html',
            'r': rval,
            'text': "This is such an interesting comment!  Upboat me! x"
        }
        new_data_dict = dict((k, urllib.quote(v).replace('%20', '+'))
                             for k, v in data.iteritems())
        new_data = 'thing_id=%(thing_id)s&text=%(text)s&id=%(id)s&r=%(r)s&uh=%(uh)s&renderstyle=%(renderstyle)s' % (
            new_data_dict)

        # submit comment
        r = br.open(BASE_URL + '/api/comment', new_data)
        r.read()
        assert (r.code == 200), 'Bad HTTP Response'

        user.checkin()