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
00d5c5b4
Commit
00d5c5b4
authored
May 30, 2014
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse course creator user in bok-choy tests and have them not be global staff
parent
049e9f0d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
8 deletions
+66
-8
common/test/acceptance/fixtures/course.py
+14
-0
common/test/acceptance/tests/test_studio_acid_xblock.py
+14
-1
common/test/acceptance/tests/test_studio_container.py
+9
-1
common/test/acceptance/tests/test_studio_general.py
+29
-6
No files found.
common/test/acceptance/fixtures/course.py
View file @
00d5c5b4
...
...
@@ -3,6 +3,7 @@ Fixture to create a course and course components (XBlocks).
"""
import
json
import
re
import
datetime
import
requests
from
textwrap
import
dedent
...
...
@@ -24,6 +25,9 @@ class StudioApiFixture(object):
"""
Base class for fixtures that use the Studio restful API.
"""
def
__init__
(
self
):
# Info about the auto-auth user used to create the course.
self
.
user
=
{}
@lazy
def
session
(
self
):
...
...
@@ -37,6 +41,14 @@ class StudioApiFixture(object):
# Return the session from the request
if
response
.
ok
:
# auto_auth returns information about the newly created user
# capture this so it can be used by by the testcases.
user_pattern
=
re
.
compile
(
'Logged in user {0}
\
({1}
\
) with password {2} and user_id {3}'
.
format
(
'(?P<username>
\
S+)'
,
'(?P<email>[^
\
)]+)'
,
'(?P<password>
\
S+)'
,
'(?P<user_id>
\
d+)'
))
user_matches
=
re
.
match
(
user_pattern
,
response
.
text
)
if
user_matches
:
self
.
user
=
user_matches
.
groupdict
()
return
session
else
:
...
...
@@ -238,6 +250,8 @@ class CourseFixture(StudioApiFixture):
self
.
_upload_assets
()
self
.
_create_xblock_children
(
self
.
_course_location
,
self
.
_children
)
return
self
@property
def
_course_key
(
self
):
"""
...
...
common/test/acceptance/tests/test_studio_acid_xblock.py
View file @
00d5c5b4
...
...
@@ -32,7 +32,6 @@ class XBlockAcidBase(WebAppTest):
'display_name'
:
'Test Course '
+
self
.
unique_id
}
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
self
.
outline
=
CourseOutlinePage
(
self
.
browser
,
self
.
course_info
[
'org'
],
...
...
@@ -44,6 +43,13 @@ class XBlockAcidBase(WebAppTest):
self
.
setup_fixtures
()
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
False
,
username
=
self
.
user
.
get
(
'username'
),
email
=
self
.
user
.
get
(
'email'
),
password
=
self
.
user
.
get
(
'password'
)
)
self
.
auth_page
.
visit
()
def
validate_acid_block_preview
(
self
,
acid_block
):
...
...
@@ -112,6 +118,8 @@ class XBlockAcidNoChildTest(XBlockAcidBase):
)
)
.
install
()
self
.
user
=
course_fix
.
user
class
XBlockAcidParentBase
(
XBlockAcidBase
):
"""
...
...
@@ -167,6 +175,8 @@ class XBlockAcidEmptyParentTest(XBlockAcidParentBase):
)
)
.
install
()
self
.
user
=
course_fix
.
user
class
XBlockAcidChildTest
(
XBlockAcidParentBase
):
"""
...
...
@@ -197,6 +207,9 @@ class XBlockAcidChildTest(XBlockAcidParentBase):
)
)
.
install
()
self
.
user
=
course_fix
.
user
@skip
(
'This will fail until we fix support of children in pure XBlocks'
)
def
test_acid_block_preview
(
self
):
super
(
XBlockAcidChildTest
,
self
)
.
test_acid_block_preview
()
...
...
common/test/acceptance/tests/test_studio_container.py
View file @
00d5c5b4
...
...
@@ -25,7 +25,6 @@ class ContainerBase(UniqueCourseTest):
# Ensure that the superclass sets up
super
(
ContainerBase
,
self
)
.
setUp
()
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
self
.
outline
=
CourseOutlinePage
(
self
.
browser
,
self
.
course_info
[
'org'
],
...
...
@@ -58,6 +57,13 @@ class ContainerBase(UniqueCourseTest):
self
.
setup_fixtures
()
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
False
,
username
=
self
.
user
.
get
(
'username'
),
email
=
self
.
user
.
get
(
'email'
),
password
=
self
.
user
.
get
(
'password'
)
)
self
.
auth_page
.
visit
()
def
setup_fixtures
(
self
):
...
...
@@ -88,6 +94,8 @@ class ContainerBase(UniqueCourseTest):
)
)
.
install
()
self
.
user
=
course_fix
.
user
def
go_to_container_page
(
self
,
make_draft
=
False
):
unit
=
self
.
go_to_unit_page
(
make_draft
)
container
=
unit
.
components
[
0
]
.
go_to_container
()
...
...
common/test/acceptance/tests/test_studio_general.py
View file @
00d5c5b4
...
...
@@ -77,14 +77,26 @@ class CoursePagesTest(UniqueCourseTest):
"""
super
(
CoursePagesTest
,
self
)
.
setUp
()
CourseFixture
(
course_fix
=
CourseFixture
(
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
],
self
.
course_info
[
'display_name'
]
)
.
install
()
)
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
course_fix
.
install
()
# Log in as the user that created the course, and also make it
# so that they are no longer global staff.
# They will have been given instructor access to the course
# and enrolled in it when they created it.
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
False
,
username
=
course_fix
.
user
.
get
(
'username'
),
email
=
course_fix
.
user
.
get
(
'email'
),
password
=
course_fix
.
user
.
get
(
'password'
)
)
self
.
pages
=
[
clz
(
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
])
...
...
@@ -116,7 +128,8 @@ class DiscussionPreviewTest(UniqueCourseTest):
def
setUp
(
self
):
super
(
DiscussionPreviewTest
,
self
)
.
setUp
()
CourseFixture
(
**
self
.
course_info
)
.
add_children
(
course_fix
=
CourseFixture
(
**
self
.
course_info
)
.
add_children
(
XBlockFixtureDesc
(
"chapter"
,
"Test Section"
)
.
add_children
(
XBlockFixtureDesc
(
"sequential"
,
"Test Subsection"
)
.
add_children
(
XBlockFixtureDesc
(
"vertical"
,
"Test Unit"
)
.
add_children
(
...
...
@@ -127,9 +140,19 @@ class DiscussionPreviewTest(UniqueCourseTest):
)
)
)
)
.
install
()
)
course_fix
.
install
()
self
.
auth_page
=
AutoAuthPage
(
self
.
browser
,
staff
=
False
,
username
=
course_fix
.
user
.
get
(
'username'
),
email
=
course_fix
.
user
.
get
(
'email'
),
password
=
course_fix
.
user
.
get
(
'password'
)
)
self
.
auth_page
.
visit
()
AutoAuthPage
(
self
.
browser
,
staff
=
True
)
.
visit
()
cop
=
CourseOutlinePage
(
self
.
browser
,
self
.
course_info
[
'org'
],
...
...
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