Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
34ddb014
Commit
34ddb014
authored
Sep 03, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial forum scripts
parent
f2d3cc2d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
0 deletions
+113
-0
common/test/load/multimech/forum/config.cfg
+17
-0
common/test/load/multimech/forum/test_scripts/forum_load.py
+52
-0
common/test/load/multimech/forum/test_scripts/forum_search.py
+44
-0
No files found.
common/test/load/multimech/forum/config.cfg
0 → 100644
View file @
34ddb014
[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
common/test/load/multimech/forum/test_scripts/forum_load.py
0 → 100644
View file @
34ddb014
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"
common/test/load/multimech/forum/test_scripts/forum_search.py
0 → 100644
View file @
34ddb014
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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment