Commit 34ddb014 by Victor Shnayder

initial forum scripts

parent f2d3cc2d
[global]
run_time = 90
rampup = 60
results_ts_interval = 10
progress_bar = on
console_logging = on
xml_report = off
# [user_group-1]
# threads = 100
# script = forum_load.py
[user_group-2]
threads = 100
script = forum_search.py
import random
import time
import requests
import random
# NOTE: Script relies on this user being signed up for cs188, and cs188 having started.
email = 'victor+test@edx.org'
password = 'abc123'
machine = 'load-test-001.m.edx.org'
protocol = 'http://'
auth = ('anant', 'agarwal')
def url(path):
"""
path should be something like '/', '/courses'
"""
return ''.join([protocol, machine, path])
class Transaction(object):
def __init__(self):
# Load / to get csrf cookie
s = requests.session(auth=auth)
r = s.get(url('/'))
# Need to set the header as well as the cookie. Why? No one knows.
headers = {'X-CSRFToken' : s.cookies['csrftoken']}
# login
r = s.post(url('/login'), data={'email' : email, 'password': password}, headers=headers)
print r.text
#print 'login req headers', r.request.headers
#print 'login resp headers', r.headers
#print 'status code: ', r.status_code
# assert r.status_code == requests.codes.ok
#print "cookies: {0}".format(r.cookies)
self.session = s
def run(self):
s = self.session
r = s.get(url('/courses/BerkeleyX/CS188/fa12/discussion/forum/'))
assert r.status_code == requests.codes.ok
r.raw.read()
if __name__ == '__main__':
trans = Transaction()
print "running..."
trans.run()
print "run done"
import random
import time
import requests
import random
# NOTE: Script relies on this user being signed up for cs188, and cs188 having started.
email = 'victor+test@edx.org'
password = 'abc123'
machine = 'load-test-001.m.edx.org'
protocol = 'http://'
auth = ('anant', 'agarwal')
def url(path):
"""
path should be something like '/', '/courses'
"""
return ''.join([protocol, machine, path])
class Transaction(object):
def __init__(self):
# Load / to get csrf cookie
s = requests.session(auth=auth)
r = s.get(url('/'))
# Need to set the header as well as the cookie. Why? No one knows.
headers = {'X-CSRFToken' : s.cookies['csrftoken']}
# login
r = s.post(url('/login'), data={'email' : email, 'password': password}, headers=headers)
print r.text
self.session = s
def run(self):
s = self.session
r = s.get(url('/courses/BerkeleyX/CS188/fa12/discussion/forum/'
'?sort_key=activity&sort_order=desc&page=1&text=um'))
assert r.status_code == requests.codes.ok
if __name__ == '__main__':
trans = Transaction()
print "running..."
trans.run()
print "run done"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment