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
2293a37f
Commit
2293a37f
authored
Jan 07, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move over old Staff Grading tests to new app.
parent
e410703e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
97 deletions
+96
-97
lms/djangoapps/instructor/tests.py
+0
-93
lms/djangoapps/open_ended_grading/tests.py
+96
-4
No files found.
lms/djangoapps/instructor/tests.py
View file @
2293a37f
...
...
@@ -25,7 +25,6 @@ from django_comment_client.models import Role, FORUM_ROLE_ADMINISTRATOR, \
FORUM_ROLE_MODERATOR
,
FORUM_ROLE_COMMUNITY_TA
,
FORUM_ROLE_STUDENT
from
django_comment_client.utils
import
has_forum_access
from
instructor
import
staff_grading_service
from
courseware.access
import
_course_staff_group_name
import
courseware.tests.tests
as
ct
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -100,7 +99,6 @@ def action_name(operation, rolename):
return
'{0} forum {1}'
.
format
(
operation
,
FORUM_ADMIN_ACTION_SUFFIX
[
rolename
])
_mock_service
=
staff_grading_service
.
MockStaffGradingService
()
@override_settings
(
MODULESTORE
=
ct
.
TEST_DATA_XML_MODULESTORE
)
class
TestInstructorDashboardForumAdmin
(
ct
.
PageLoader
):
...
...
@@ -223,94 +221,3 @@ class TestInstructorDashboardForumAdmin(ct.PageLoader):
self
.
assertTrue
(
response
.
content
.
find
(
'<td>{0}</td>'
.
format
(
roles
))
>=
0
,
'not finding roles "{0}"'
.
format
(
roles
))
@override_settings
(
MODULESTORE
=
ct
.
TEST_DATA_XML_MODULESTORE
)
class
TestStaffGradingService
(
ct
.
PageLoader
):
'''
Check that staff grading service proxy works. Basically just checking the
access control and error handling logic -- all the actual work is on the
backend.
'''
def
setUp
(
self
):
xmodule
.
modulestore
.
django
.
_MODULESTORES
=
{}
self
.
student
=
'view@test.com'
self
.
instructor
=
'view2@test.com'
self
.
password
=
'foo'
self
.
location
=
'TestLocation'
self
.
create_account
(
'u1'
,
self
.
student
,
self
.
password
)
self
.
create_account
(
'u2'
,
self
.
instructor
,
self
.
password
)
self
.
activate_user
(
self
.
student
)
self
.
activate_user
(
self
.
instructor
)
self
.
course_id
=
"edX/toy/2012_Fall"
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
def
make_instructor
(
course
):
group_name
=
_course_staff_group_name
(
course
.
location
)
g
=
Group
.
objects
.
create
(
name
=
group_name
)
g
.
user_set
.
add
(
ct
.
user
(
self
.
instructor
))
make_instructor
(
self
.
toy
)
self
.
mock_service
=
staff_grading_service
.
grading_service
()
self
.
logout
()
def
test_access
(
self
):
"""
Make sure only staff have access.
"""
self
.
login
(
self
.
student
,
self
.
password
)
# both get and post should return 404
for
view_name
in
(
'staff_grading_get_next'
,
'staff_grading_save_grade'
):
url
=
reverse
(
view_name
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
self
.
check_for_get_code
(
404
,
url
)
self
.
check_for_post_code
(
404
,
url
)
def
test_get_next
(
self
):
self
.
login
(
self
.
instructor
,
self
.
password
)
url
=
reverse
(
'staff_grading_get_next'
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
data
=
{
'location'
:
self
.
location
}
r
=
self
.
check_for_post_code
(
200
,
url
,
data
)
d
=
json
.
loads
(
r
.
content
)
self
.
assertTrue
(
d
[
'success'
])
self
.
assertEquals
(
d
[
'submission_id'
],
self
.
mock_service
.
cnt
)
self
.
assertIsNotNone
(
d
[
'submission'
])
self
.
assertIsNotNone
(
d
[
'num_graded'
])
self
.
assertIsNotNone
(
d
[
'min_for_ml'
])
self
.
assertIsNotNone
(
d
[
'num_pending'
])
self
.
assertIsNotNone
(
d
[
'prompt'
])
self
.
assertIsNotNone
(
d
[
'ml_error_info'
])
self
.
assertIsNotNone
(
d
[
'max_score'
])
self
.
assertIsNotNone
(
d
[
'rubric'
])
def
test_save_grade
(
self
):
self
.
login
(
self
.
instructor
,
self
.
password
)
url
=
reverse
(
'staff_grading_save_grade'
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
data
=
{
'score'
:
'12'
,
'feedback'
:
'great!'
,
'submission_id'
:
'123'
,
'location'
:
self
.
location
}
r
=
self
.
check_for_post_code
(
200
,
url
,
data
)
d
=
json
.
loads
(
r
.
content
)
self
.
assertTrue
(
d
[
'success'
],
str
(
d
))
self
.
assertEquals
(
d
[
'submission_id'
],
self
.
mock_service
.
cnt
)
def
test_get_problem_list
(
self
):
self
.
login
(
self
.
instructor
,
self
.
password
)
url
=
reverse
(
'staff_grading_get_problem_list'
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
data
=
{}
r
=
self
.
check_for_post_code
(
200
,
url
,
data
)
d
=
json
.
loads
(
r
.
content
)
self
.
assertTrue
(
d
[
'success'
],
str
(
d
))
self
.
assertIsNotNone
(
d
[
'problem_list'
])
lms/djangoapps/open_ended_grading/tests.py
View file @
2293a37f
...
...
@@ -6,11 +6,103 @@ Replace this with more appropriate tests for your application.
"""
from
django.test
import
TestCase
from
instructor
import
staff_grading_service
from
django.core.urlresolvers
import
reverse
from
django.contrib.auth.models
import
Group
from
courseware.access
import
_course_staff_group_name
import
courseware.tests.tests
as
ct
from
xmodule.modulestore.django
import
modulestore
import
xmodule.modulestore.django
class
SimpleTest
(
TestCase
):
def
test_basic_addition
(
self
):
_mock_service
=
staff_grading_service
.
MockStaffGradingService
()
@override_settings
(
MODULESTORE
=
ct
.
TEST_DATA_XML_MODULESTORE
)
class
TestStaffGradingService
(
ct
.
PageLoader
):
'''
Check that staff grading service proxy works. Basically just checking the
access control and error handling logic -- all the actual work is on the
backend.
'''
def
setUp
(
self
):
xmodule
.
modulestore
.
django
.
_MODULESTORES
=
{}
self
.
student
=
'view@test.com'
self
.
instructor
=
'view2@test.com'
self
.
password
=
'foo'
self
.
location
=
'TestLocation'
self
.
create_account
(
'u1'
,
self
.
student
,
self
.
password
)
self
.
create_account
(
'u2'
,
self
.
instructor
,
self
.
password
)
self
.
activate_user
(
self
.
student
)
self
.
activate_user
(
self
.
instructor
)
self
.
course_id
=
"edX/toy/2012_Fall"
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
def
make_instructor
(
course
):
group_name
=
_course_staff_group_name
(
course
.
location
)
g
=
Group
.
objects
.
create
(
name
=
group_name
)
g
.
user_set
.
add
(
ct
.
user
(
self
.
instructor
))
make_instructor
(
self
.
toy
)
self
.
mock_service
=
staff_grading_service
.
grading_service
()
self
.
logout
()
def
test_access
(
self
):
"""
Tests that 1 + 1 always equals 2
.
Make sure only staff have access
.
"""
self
.
assertEqual
(
1
+
1
,
2
)
self
.
login
(
self
.
student
,
self
.
password
)
# both get and post should return 404
for
view_name
in
(
'staff_grading_get_next'
,
'staff_grading_save_grade'
):
url
=
reverse
(
view_name
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
self
.
check_for_get_code
(
404
,
url
)
self
.
check_for_post_code
(
404
,
url
)
def
test_get_next
(
self
):
self
.
login
(
self
.
instructor
,
self
.
password
)
url
=
reverse
(
'staff_grading_get_next'
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
data
=
{
'location'
:
self
.
location
}
r
=
self
.
check_for_post_code
(
200
,
url
,
data
)
d
=
json
.
loads
(
r
.
content
)
self
.
assertTrue
(
d
[
'success'
])
self
.
assertEquals
(
d
[
'submission_id'
],
self
.
mock_service
.
cnt
)
self
.
assertIsNotNone
(
d
[
'submission'
])
self
.
assertIsNotNone
(
d
[
'num_graded'
])
self
.
assertIsNotNone
(
d
[
'min_for_ml'
])
self
.
assertIsNotNone
(
d
[
'num_pending'
])
self
.
assertIsNotNone
(
d
[
'prompt'
])
self
.
assertIsNotNone
(
d
[
'ml_error_info'
])
self
.
assertIsNotNone
(
d
[
'max_score'
])
self
.
assertIsNotNone
(
d
[
'rubric'
])
def
test_save_grade
(
self
):
self
.
login
(
self
.
instructor
,
self
.
password
)
url
=
reverse
(
'staff_grading_save_grade'
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
data
=
{
'score'
:
'12'
,
'feedback'
:
'great!'
,
'submission_id'
:
'123'
,
'location'
:
self
.
location
}
r
=
self
.
check_for_post_code
(
200
,
url
,
data
)
d
=
json
.
loads
(
r
.
content
)
self
.
assertTrue
(
d
[
'success'
],
str
(
d
))
self
.
assertEquals
(
d
[
'submission_id'
],
self
.
mock_service
.
cnt
)
def
test_get_problem_list
(
self
):
self
.
login
(
self
.
instructor
,
self
.
password
)
url
=
reverse
(
'staff_grading_get_problem_list'
,
kwargs
=
{
'course_id'
:
self
.
course_id
})
data
=
{}
r
=
self
.
check_for_post_code
(
200
,
url
,
data
)
d
=
json
.
loads
(
r
.
content
)
self
.
assertTrue
(
d
[
'success'
],
str
(
d
))
self
.
assertIsNotNone
(
d
[
'problem_list'
])
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