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
367dc257
Commit
367dc257
authored
Feb 13, 2015
by
Brandon DeRosier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test multi-page gitlogs
parent
805e2d63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
lms/djangoapps/dashboard/sysadmin.py
+4
-2
lms/djangoapps/dashboard/tests/test_sysadmin.py
+16
-9
No files found.
lms/djangoapps/dashboard/sysadmin.py
View file @
367dc257
...
...
@@ -744,8 +744,10 @@ class GitLogs(TemplateView):
except
PageNotAnInteger
:
logs
=
paginator
.
page
(
1
)
except
EmptyPage
:
# If the page is too high
logs
=
paginator
.
page
(
paginator
.
num_pages
)
# If the page is too high or low
given_page
=
int
(
request
.
GET
.
get
(
'page'
))
page
=
min
(
max
(
1
,
given_page
),
paginator
.
num_pages
)
logs
=
paginator
.
page
(
page
)
mdb
.
disconnect
()
context
=
{
...
...
lms/djangoapps/dashboard/tests/test_sysadmin.py
View file @
367dc257
...
...
@@ -25,6 +25,7 @@ from xmodule.modulestore.tests.django_utils import (
from
dashboard.models
import
CourseImportLog
from
dashboard.sysadmin
import
Users
from
dashboard.git_import
import
GitImportError
from
datetime
import
datetime
from
external_auth.models
import
ExternalAuthMap
from
student.roles
import
CourseStaffRole
,
GlobalStaff
from
student.tests.factories
import
UserFactory
...
...
@@ -589,26 +590,32 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase):
"""
self
.
_setstaff_login
()
self
.
_mkdir
(
getattr
(
settings
,
'GIT_REPO_DIR'
))
self
.
_add_edx4edx
(
)
mongoengine
.
connect
(
TEST_MONGODB_LOG
[
'db'
]
)
for
page
in
[
-
1
,
0
,
1
,
2
,
'abc'
]:
# Test the page parameter in various different ways
for
_
in
xrange
(
15
):
CourseImportLog
(
course_id
=
SlashSeparatedCourseKey
(
"test"
,
"test"
,
"test"
),
location
=
"location"
,
import_log
=
"import_log"
,
git_log
=
"git_log"
,
repo_dir
=
"repo_dir"
,
created
=
datetime
.
now
()
)
.
save
()
for
page
,
expected
in
[(
-
1
,
1
),
(
1
,
1
),
(
2
,
2
),
(
30
,
2
),
(
'abc'
,
1
)]:
response
=
self
.
client
.
get
(
'{}?page={}'
.
format
(
reverse
(
'gitlogs_detail'
,
kwargs
=
{
'course_id'
:
'MITx/edx4edx/edx4edx'
}),
reverse
(
'gitlogs'
),
page
)
)
self
.
assertIn
(
'Page
1 of 1'
,
'Page
{} of 2'
.
format
(
expected
)
,
response
.
content
)
self
.
_rm_edx4edx
()
CourseImportLog
.
objects
.
delete
()
def
test_gitlog_courseteam_access
(
self
):
"""
...
...
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