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
aca292de
Commit
aca292de
authored
Dec 08, 2015
by
asadiqbal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SOL-1490
parent
dfd9b463
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
1 deletions
+147
-1
lms/djangoapps/instructor/views/api.py
+1
-1
lms/static/js/spec/instructor_dashboard/certificates_bulk_exception_spec.js
+145
-0
lms/static/js/spec/main.js
+1
-0
No files found.
lms/djangoapps/instructor/views/api.py
View file @
aca292de
...
...
@@ -2949,7 +2949,7 @@ def generate_bulk_certificate_exceptions(request, course_id): # pylint: disable
"""
inner method to build dict of csv data as row errors.
"""
row_errors
[
key
]
.
append
(
_
(
'user "{user}" in row#
{row}'
)
.
format
(
user
=
_user
,
row
=
row_count
))
row_errors
[
key
]
.
append
(
_
(
'user "{user}" in row# {row}'
)
.
format
(
user
=
_user
,
row
=
row_count
))
if
'students_list'
in
request
.
FILES
:
try
:
...
...
lms/static/js/spec/instructor_dashboard/certificates_bulk_exception_spec.js
0 → 100644
View file @
aca292de
define
([
'jquery'
,
'js/certificates/views/certificate_bulk_whitelist'
],
function
(
$
,
CertificateBulkWhiteListView
)
{
'use strict'
;
describe
(
"certificate bulk exceptions generation"
,
function
()
{
var
certificate_bulk_exception_url
=
'test/url/'
;
var
SELECTORS
=
{
upload_csv_button
:
".upload-csv-button"
,
bulk_white_list_exception_form
:
"form#bulk-white-list-exception-form"
,
bulk_exception_results
:
".bulk-exception-results"
};
beforeEach
(
function
()
{
setFixtures
();
var
fixture
=
readFixtures
(
"templates/instructor/instructor_dashboard_2/certificate-bulk-white-list.underscore"
);
setFixtures
(
"<script type='text/template' id='certificate-bulk-white-list-tpl'>"
+
fixture
+
"</script>"
+
"<div class='bulk-white-list-exception'></div>"
);
this
.
view
=
new
CertificateBulkWhiteListView
({
bulk_exception_url
:
certificate_bulk_exception_url
});
this
.
view
.
render
();
});
it
(
'bind the ajax call and the result will be success'
,
function
()
{
var
submitCallback
;
spyOn
(
$
,
"ajax"
).
andCallFake
(
function
(
params
)
{
params
.
success
({
row_errors
:
{},
general_errors
:
[],
success
:
[
"user test in row# 1"
]
});
return
{
always
:
function
()
{}
};
});
submitCallback
=
jasmine
.
createSpy
().
andReturn
();
this
.
view
.
$el
.
find
(
SELECTORS
.
bulk_white_list_exception_form
).
submit
(
submitCallback
);
this
.
view
.
$el
.
find
(
SELECTORS
.
upload_csv_button
).
click
();
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'1 learner is successfully added to the '
+
'exception list'
);
});
it
(
'bind the ajax call and the result will be general error'
,
function
()
{
var
submitCallback
;
spyOn
(
$
,
"ajax"
).
andCallFake
(
function
(
params
)
{
params
.
success
({
row_errors
:
{},
general_errors
:
[
"File is not attached."
],
success
:
[]
});
return
{
always
:
function
()
{}
};
});
submitCallback
=
jasmine
.
createSpy
().
andReturn
();
this
.
view
.
$el
.
find
(
SELECTORS
.
bulk_white_list_exception_form
).
submit
(
submitCallback
);
this
.
view
.
$el
.
find
(
SELECTORS
.
upload_csv_button
).
click
();
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'File is not attached.'
);
});
it
(
'bind the ajax call and the result will be singular form of row errors'
,
function
()
{
var
submitCallback
;
spyOn
(
$
,
"ajax"
).
andCallFake
(
function
(
params
)
{
params
.
success
({
general_errors
:
[],
row_errors
:
{
data_format_error
:
[
'user 1 in row# 1'
],
user_not_exist
:
[
'user 2 in row# 2'
],
user_already_white_listed
:
[
'user 3 in row# 3'
],
user_not_enrolled
:
[
'user 4 in row# 4'
]
},
success
:
[]
});
return
{
always
:
function
()
{}
};
});
submitCallback
=
jasmine
.
createSpy
().
andReturn
();
this
.
view
.
$el
.
find
(
SELECTORS
.
bulk_white_list_exception_form
).
submit
(
submitCallback
);
this
.
view
.
$el
.
find
(
SELECTORS
.
upload_csv_button
).
click
();
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'1 record is not in correct format'
);
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'1 learner does not exist in LMS'
);
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'1 learner is already white listed'
);
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'1 learner is not enrolled in course'
);
});
it
(
'bind the ajax call and the result will be plural form of row errors'
,
function
()
{
var
submitCallback
;
spyOn
(
$
,
"ajax"
).
andCallFake
(
function
(
params
)
{
params
.
success
({
general_errors
:
[],
row_errors
:
{
data_format_error
:
[
'user 1 in row# 1'
,
'user 1 in row# 1'
],
user_not_exist
:
[
'user 2 in row# 2'
,
'user 2 in row# 2'
],
user_already_white_listed
:
[
'user 3 in row# 3'
,
'user 3 in row# 3'
],
user_not_enrolled
:
[
'user 4 in row# 4'
,
'user 4 in row# 4'
]
},
success
:
[]
});
return
{
always
:
function
()
{}
};
});
submitCallback
=
jasmine
.
createSpy
().
andReturn
();
this
.
view
.
$el
.
find
(
SELECTORS
.
bulk_white_list_exception_form
).
submit
(
submitCallback
);
this
.
view
.
$el
.
find
(
SELECTORS
.
upload_csv_button
).
click
();
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'2 records are not in correct format'
);
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'2 learners do not exist in LMS'
);
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'2 learners are already white listed'
);
expect
(
$
(
SELECTORS
.
bulk_exception_results
).
text
()).
toContain
(
'2 learners are not enrolled in course'
);
});
it
(
'toggle message details'
,
function
()
{
var
submitCallback
;
spyOn
(
$
,
"ajax"
).
andCallFake
(
function
(
params
)
{
params
.
success
({
row_errors
:
{},
general_errors
:
[],
success
:
[
"user test in row# 1"
]
});
return
{
always
:
function
()
{}
};
});
submitCallback
=
jasmine
.
createSpy
().
andReturn
();
this
.
view
.
$el
.
find
(
SELECTORS
.
bulk_white_list_exception_form
).
submit
(
submitCallback
);
this
.
view
.
$el
.
find
(
SELECTORS
.
upload_csv_button
).
click
();
expect
(
this
.
view
.
$el
.
find
(
"div.message > .successfully-added"
)).
toBeHidden
();
this
.
view
.
$el
.
find
(
"a.arrow#successfully-added"
).
trigger
(
"click"
);
expect
(
this
.
view
.
$el
.
find
(
"div.message > .successfully-added"
)).
toBeVisible
();
});
});
});
lms/static/js/spec/main.js
View file @
aca292de
...
...
@@ -648,6 +648,7 @@
'lms/include/js/spec/instructor_dashboard/ecommerce_spec.js'
,
'lms/include/js/spec/instructor_dashboard/student_admin_spec.js'
,
'lms/include/js/spec/instructor_dashboard/certificates_exception_spec.js'
,
'lms/include/js/spec/instructor_dashboard/certificates_bulk_exception_spec.js'
,
'lms/include/js/spec/instructor_dashboard/certificates_spec.js'
,
'lms/include/js/spec/student_account/account_spec.js'
,
'lms/include/js/spec/student_account/access_spec.js'
,
...
...
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