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
091db262
Commit
091db262
authored
Jan 30, 2015
by
Zia Fazal
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some broken tests
parent
a8cc6702
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
21 deletions
+39
-21
lms/djangoapps/api_manager/courses/tests.py
+24
-12
lms/djangoapps/api_manager/groups/tests.py
+4
-1
lms/djangoapps/api_manager/users/tests.py
+11
-8
No files found.
lms/djangoapps/api_manager/courses/tests.py
View file @
091db262
...
@@ -104,9 +104,11 @@ class CoursesApiTests(ModuleStoreTestCase):
...
@@ -104,9 +104,11 @@ class CoursesApiTests(ModuleStoreTestCase):
self
.
test_group_name
=
'Alpha Group'
self
.
test_group_name
=
'Alpha Group'
self
.
attempts
=
3
self
.
attempts
=
3
self
.
course_start_date
=
timezone
.
now
()
+
relativedelta
(
days
=-
1
)
self
.
course_end_date
=
timezone
.
now
()
+
relativedelta
(
days
=
60
)
self
.
course
=
CourseFactory
.
create
(
self
.
course
=
CourseFactory
.
create
(
start
=
datetime
(
2014
,
6
,
16
,
14
,
30
)
,
start
=
self
.
course_start_date
,
end
=
datetime
(
2015
,
1
,
16
)
end
=
self
.
course_end_date
)
)
self
.
test_data
=
'<html>{}</html>'
.
format
(
str
(
uuid
.
uuid4
()))
self
.
test_data
=
'<html>{}</html>'
.
format
(
str
(
uuid
.
uuid4
()))
...
@@ -114,7 +116,7 @@ class CoursesApiTests(ModuleStoreTestCase):
...
@@ -114,7 +116,7 @@ class CoursesApiTests(ModuleStoreTestCase):
category
=
"chapter"
,
category
=
"chapter"
,
parent_location
=
self
.
course
.
location
,
parent_location
=
self
.
course
.
location
,
data
=
self
.
test_data
,
data
=
self
.
test_data
,
due
=
datetime
(
2014
,
5
,
16
,
14
,
30
)
,
due
=
self
.
course_end_date
,
display_name
=
"Overview"
display_name
=
"Overview"
)
)
...
@@ -195,8 +197,8 @@ class CoursesApiTests(ModuleStoreTestCase):
...
@@ -195,8 +197,8 @@ class CoursesApiTests(ModuleStoreTestCase):
)
)
self
.
empty_course
=
CourseFactory
.
create
(
self
.
empty_course
=
CourseFactory
.
create
(
start
=
datetime
(
2014
,
6
,
16
,
14
,
30
)
,
start
=
self
.
course_start_date
,
end
=
datetime
(
2015
,
1
,
16
)
,
end
=
self
.
course_end_date
,
org
=
"MTD"
org
=
"MTD"
)
)
...
@@ -2020,28 +2022,35 @@ class CoursesApiTests(ModuleStoreTestCase):
...
@@ -2020,28 +2022,35 @@ class CoursesApiTests(ModuleStoreTestCase):
course
=
CourseFactory
.
create
(
course
=
CourseFactory
.
create
(
number
=
'3033'
,
number
=
'3033'
,
name
=
'metrics_in_timeseries'
,
name
=
'metrics_in_timeseries'
,
start
=
datetime
(
2014
,
9
,
16
,
14
,
30
),
start
=
self
.
course_start_date
,
end
=
datetime
(
2015
,
1
,
16
)
end
=
self
.
course_end_date
)
second_course
=
CourseFactory
.
create
(
number
=
'3034'
,
name
=
'metrics_in_timeseries'
,
start
=
self
.
course_start_date
,
end
=
self
.
course_end_date
)
)
chapter
=
ItemFactory
.
create
(
chapter
=
ItemFactory
.
create
(
category
=
"chapter"
,
category
=
"chapter"
,
parent_location
=
course
.
location
,
parent_location
=
course
.
location
,
data
=
self
.
test_data
,
data
=
self
.
test_data
,
due
=
datetime
(
2015
,
5
,
16
,
14
,
30
)
,
due
=
self
.
course_end_date
,
display_name
=
"
Overview"
display_name
=
u"3033
Overview"
)
)
sub_section
=
ItemFactory
.
create
(
sub_section
=
ItemFactory
.
create
(
parent_location
=
chapter
.
location
,
parent_location
=
chapter
.
location
,
category
=
"sequential"
,
category
=
"sequential"
,
display_name
=
u"
test subsection"
,
display_name
=
"3033
test subsection"
,
)
)
unit
=
ItemFactory
.
create
(
unit
=
ItemFactory
.
create
(
parent_location
=
sub_section
.
location
,
parent_location
=
sub_section
.
location
,
category
=
"vertical"
,
category
=
"vertical"
,
metadata
=
{
'graded'
:
True
,
'format'
:
'Homework'
},
metadata
=
{
'graded'
:
True
,
'format'
:
'Homework'
},
display_name
=
u"test unit"
,
display_name
=
u"
3033
test unit"
,
)
)
item
=
ItemFactory
.
create
(
item
=
ItemFactory
.
create
(
...
@@ -2080,6 +2089,7 @@ class CoursesApiTests(ModuleStoreTestCase):
...
@@ -2080,6 +2089,7 @@ class CoursesApiTests(ModuleStoreTestCase):
with
freeze_time
(
enrolled_time
):
with
freeze_time
(
enrolled_time
):
for
user
in
users
:
for
user
in
users
:
CourseEnrollmentFactory
.
create
(
user
=
user
,
course_id
=
course
.
id
)
CourseEnrollmentFactory
.
create
(
user
=
user
,
course_id
=
course
.
id
)
CourseEnrollmentFactory
.
create
(
user
=
user
,
course_id
=
second_course
.
id
)
points_scored
=
.
25
points_scored
=
.
25
points_possible
=
1
points_possible
=
1
...
@@ -2095,6 +2105,8 @@ class CoursesApiTests(ModuleStoreTestCase):
...
@@ -2095,6 +2105,8 @@ class CoursesApiTests(ModuleStoreTestCase):
# Last 2 users as those who have completed
# Last 2 users as those who have completed
if
j
>=
USER_COUNT
-
2
:
if
j
>=
USER_COUNT
-
2
:
second_module
=
self
.
get_module_for_user
(
user
,
course
,
item2
)
module
.
system
.
publish
(
second_module
,
'grade'
,
grade_dict
)
try
:
try
:
sg_entry
=
StudentGradebook
.
objects
.
get
(
user
=
user
,
course_id
=
course
.
id
)
sg_entry
=
StudentGradebook
.
objects
.
get
(
user
=
user
,
course_id
=
course
.
id
)
sg_entry
.
grade
=
0.9
sg_entry
.
grade
=
0.9
...
@@ -2135,7 +2147,7 @@ class CoursesApiTests(ModuleStoreTestCase):
...
@@ -2135,7 +2147,7 @@ class CoursesApiTests(ModuleStoreTestCase):
self
.
assertEqual
(
total_completed
,
2
)
self
.
assertEqual
(
total_completed
,
2
)
self
.
assertEqual
(
len
(
response
.
data
[
'modules_completed'
]),
5
)
self
.
assertEqual
(
len
(
response
.
data
[
'modules_completed'
]),
5
)
total_modules_completed
=
sum
([
completed
[
1
]
for
completed
in
response
.
data
[
'modules_completed'
]])
total_modules_completed
=
sum
([
completed
[
1
]
for
completed
in
response
.
data
[
'modules_completed'
]])
self
.
assertEqual
(
total_modules_completed
,
4
)
self
.
assertEqual
(
total_modules_completed
,
6
)
self
.
assertEqual
(
len
(
response
.
data
[
'active_users'
]),
5
)
self
.
assertEqual
(
len
(
response
.
data
[
'active_users'
]),
5
)
total_active
=
sum
([
active
[
1
]
for
active
in
response
.
data
[
'active_users'
]])
total_active
=
sum
([
active
[
1
]
for
active
in
response
.
data
[
'active_users'
]])
self
.
assertEqual
(
total_active
,
5
)
self
.
assertEqual
(
total_active
,
5
)
...
...
lms/djangoapps/api_manager/groups/tests.py
View file @
091db262
...
@@ -5,6 +5,7 @@ Run these tests @ Devstack:
...
@@ -5,6 +5,7 @@ Run these tests @ Devstack:
rake fasttest_lms[common/djangoapps/api_manager/tests/test_group_views.py]
rake fasttest_lms[common/djangoapps/api_manager/tests/test_group_views.py]
"""
"""
from
datetime
import
datetime
from
datetime
import
datetime
from
dateutil.relativedelta
import
relativedelta
from
random
import
randint
from
random
import
randint
import
uuid
import
uuid
import
json
import
json
...
@@ -14,6 +15,7 @@ from urllib import urlencode
...
@@ -14,6 +15,7 @@ from urllib import urlencode
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.test
import
Client
from
django.test
import
Client
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.utils
import
timezone
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
api_manager.models
import
GroupRelationship
,
GroupProfile
from
api_manager.models
import
GroupRelationship
,
GroupProfile
...
@@ -55,11 +57,12 @@ class GroupsApiTests(ModuleStoreTestCase):
...
@@ -55,11 +57,12 @@ class GroupsApiTests(ModuleStoreTestCase):
self
.
test_course_data
=
'<html>{}</html>'
.
format
(
str
(
uuid
.
uuid4
()))
self
.
test_course_data
=
'<html>{}</html>'
.
format
(
str
(
uuid
.
uuid4
()))
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
test_course_id
=
unicode
(
self
.
course
.
id
)
self
.
test_course_id
=
unicode
(
self
.
course
.
id
)
self
.
course_end_date
=
timezone
.
now
()
+
relativedelta
(
days
=
60
)
self
.
course_content
=
ItemFactory
.
create
(
self
.
course_content
=
ItemFactory
.
create
(
category
=
"videosequence"
,
category
=
"videosequence"
,
parent_location
=
self
.
course
.
location
,
parent_location
=
self
.
course
.
location
,
data
=
self
.
test_course_data
,
data
=
self
.
test_course_data
,
due
=
datetime
(
2016
,
5
,
16
,
14
,
30
)
,
due
=
self
.
course_end_date
,
display_name
=
"View_Sequence"
display_name
=
"View_Sequence"
)
)
...
...
lms/djangoapps/api_manager/users/tests.py
View file @
091db262
...
@@ -6,6 +6,7 @@ Run these tests @ Devstack:
...
@@ -6,6 +6,7 @@ Run these tests @ Devstack:
rake fasttest_lms[common/djangoapps/api_manager/tests/test_user_views.py]
rake fasttest_lms[common/djangoapps/api_manager/tests/test_user_views.py]
"""
"""
from
datetime
import
datetime
from
datetime
import
datetime
from
dateutil.relativedelta
import
relativedelta
from
random
import
randint
from
random
import
randint
import
json
import
json
import
uuid
import
uuid
...
@@ -108,10 +109,12 @@ class UsersApiTests(ModuleStoreTestCase):
...
@@ -108,10 +109,12 @@ class UsersApiTests(ModuleStoreTestCase):
self
.
test_bogus_content_id
=
'i4x://foo/bar/baz/Chapter1'
self
.
test_bogus_content_id
=
'i4x://foo/bar/baz/Chapter1'
self
.
test_course_data
=
'<html>{}</html>'
.
format
(
str
(
uuid
.
uuid4
()))
self
.
test_course_data
=
'<html>{}</html>'
.
format
(
str
(
uuid
.
uuid4
()))
self
.
course_start_date
=
timezone
.
now
()
+
relativedelta
(
days
=-
1
)
self
.
course_end_date
=
timezone
.
now
()
+
relativedelta
(
days
=
60
)
self
.
course
=
CourseFactory
.
create
(
self
.
course
=
CourseFactory
.
create
(
display_name
=
"TEST COURSE"
,
display_name
=
"TEST COURSE"
,
start
=
datetime
(
2014
,
6
,
16
,
14
,
30
)
,
start
=
self
.
course_start_date
,
end
=
datetime
(
2015
,
1
,
16
,
14
,
30
)
,
end
=
self
.
course_end_date
,
org
=
'USERTEST'
,
org
=
'USERTEST'
,
run
=
'USERTEST1'
run
=
'USERTEST1'
)
)
...
@@ -119,7 +122,7 @@ class UsersApiTests(ModuleStoreTestCase):
...
@@ -119,7 +122,7 @@ class UsersApiTests(ModuleStoreTestCase):
category
=
"videosequence"
,
category
=
"videosequence"
,
parent_location
=
self
.
course
.
location
,
parent_location
=
self
.
course
.
location
,
data
=
self
.
test_course_data
,
data
=
self
.
test_course_data
,
due
=
datetime
(
2016
,
5
,
16
,
14
,
30
)
,
due
=
self
.
course_end_date
,
display_name
=
"View_Sequence"
display_name
=
"View_Sequence"
)
)
self
.
course2
=
CourseFactory
.
create
(
display_name
=
"TEST COURSE2"
,
org
=
'TESTORG2'
,
run
=
'USERTEST2'
)
self
.
course2
=
CourseFactory
.
create
(
display_name
=
"TEST COURSE2"
,
org
=
'TESTORG2'
,
run
=
'USERTEST2'
)
...
@@ -127,7 +130,7 @@ class UsersApiTests(ModuleStoreTestCase):
...
@@ -127,7 +130,7 @@ class UsersApiTests(ModuleStoreTestCase):
category
=
"videosequence"
,
category
=
"videosequence"
,
parent_location
=
self
.
course2
.
location
,
parent_location
=
self
.
course2
.
location
,
data
=
self
.
test_course_data
,
data
=
self
.
test_course_data
,
due
=
datetime
(
2016
,
5
,
16
,
14
,
30
)
,
due
=
self
.
course_end_date
,
display_name
=
"View_Sequence2"
display_name
=
"View_Sequence2"
)
)
...
@@ -988,8 +991,8 @@ class UsersApiTests(ModuleStoreTestCase):
...
@@ -988,8 +991,8 @@ class UsersApiTests(ModuleStoreTestCase):
def
test_user_courses_detail_get
(
self
):
def
test_user_courses_detail_get
(
self
):
course
=
CourseFactory
.
create
(
course
=
CourseFactory
.
create
(
display_name
=
"UserCoursesDetailTestCourse"
,
display_name
=
"UserCoursesDetailTestCourse"
,
start
=
datetime
(
2014
,
6
,
16
,
14
,
30
)
,
start
=
self
.
course_start_date
,
end
=
datetime
(
2015
,
1
,
16
,
14
,
30
)
,
end
=
self
.
course_end_date
,
org
=
'TUCDG'
,
org
=
'TUCDG'
,
run
=
'TUCDG1'
run
=
'TUCDG1'
)
)
...
@@ -1312,7 +1315,7 @@ class UsersApiTests(ModuleStoreTestCase):
...
@@ -1312,7 +1315,7 @@ class UsersApiTests(ModuleStoreTestCase):
data
=
StringResponseXMLFactory
()
.
build_xml
(
answer
=
'bar'
),
data
=
StringResponseXMLFactory
()
.
build_xml
(
answer
=
'bar'
),
display_name
=
u"test mentoring homework 3"
,
display_name
=
u"test mentoring homework 3"
,
metadata
=
{
'rerandomize'
:
'always'
,
'graded'
:
True
,
'format'
:
"Homework"
},
metadata
=
{
'rerandomize'
:
'always'
,
'graded'
:
True
,
'format'
:
"Homework"
},
due
=
datetime
(
2015
,
1
,
16
,
14
,
30
)
.
replace
(
tzinfo
=
timezone
.
utc
)
due
=
self
.
course_end_date
.
replace
(
tzinfo
=
timezone
.
utc
)
)
)
points_scored
=
1
points_scored
=
1
points_possible
=
1
points_possible
=
1
...
@@ -1369,7 +1372,7 @@ class UsersApiTests(ModuleStoreTestCase):
...
@@ -1369,7 +1372,7 @@ class UsersApiTests(ModuleStoreTestCase):
data
=
StringResponseXMLFactory
()
.
build_xml
(
answer
=
'bar'
),
data
=
StringResponseXMLFactory
()
.
build_xml
(
answer
=
'bar'
),
display_name
=
u"test mentoring homework 3"
,
display_name
=
u"test mentoring homework 3"
,
metadata
=
{
'rerandomize'
:
'always'
,
'graded'
:
True
,
'format'
:
"Homework"
},
metadata
=
{
'rerandomize'
:
'always'
,
'graded'
:
True
,
'format'
:
"Homework"
},
due
=
datetime
(
2015
,
1
,
16
,
14
,
30
)
.
replace
(
tzinfo
=
timezone
.
utc
)
due
=
self
.
course_end_date
.
replace
(
tzinfo
=
timezone
.
utc
)
)
)
test_uri
=
'{}/{}/courses/{}/grades'
.
format
(
self
.
users_base_uri
,
user_id
,
unicode
(
course
.
id
))
test_uri
=
'{}/{}/courses/{}/grades'
.
format
(
self
.
users_base_uri
,
user_id
,
unicode
(
course
.
id
))
...
...
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