Add acceptance tests for forums comment deletion.

JIRA: FOR-472
This commit is contained in:
jsa
2014-02-22 19:16:17 -05:00
parent 7be356b390
commit bea463d950
6 changed files with 205 additions and 40 deletions

View File

@@ -57,6 +57,8 @@ from collections import namedtuple
from courseware.courses import get_courses, sort_by_announcement
from courseware.access import has_access
from django_comment_common.models import Role
from external_auth.models import ExternalAuthMap
import external_auth.views
@@ -1211,6 +1213,7 @@ def auto_auth(request):
* `full_name` for the user profile (the user's full name; defaults to the username)
* `staff`: Set to "true" to make the user global staff.
* `course_id`: Enroll the student in the course with `course_id`
* `roles`: Comma-separated list of roles to grant the student in the course with `course_id`
If username, email, or password are not provided, use
randomly generated credentials.
@@ -1226,6 +1229,7 @@ def auto_auth(request):
full_name = request.GET.get('full_name', username)
is_staff = request.GET.get('staff', None)
course_id = request.GET.get('course_id', None)
role_names = [v.strip() for v in request.GET.get('roles', '').split(',') if v.strip()]
# Get or create the user object
post_data = {
@@ -1268,6 +1272,11 @@ def auto_auth(request):
if course_id is not None:
CourseEnrollment.enroll(user, course_id)
# Apply the roles
for role_name in role_names:
role = Role.objects.get(name=role_name, course_id=course_id)
user.roles.add(role)
# Log in as the user
user = authenticate(username=username, password=password)
login(request, user)