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
7be6880f
Commit
7be6880f
authored
Jun 07, 2013
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add course id tagging to feedback submissions
parent
73d3b145
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
21 deletions
+22
-21
common/djangoapps/util/tests/test_submit_feedback.py
+18
-20
common/djangoapps/util/views.py
+1
-1
lms/templates/help_modal.html
+3
-0
No files found.
common/djangoapps/util/tests/test_submit_feedback.py
View file @
7be6880f
...
@@ -27,15 +27,16 @@ class SubmitFeedbackTest(TestCase):
...
@@ -27,15 +27,16 @@ class SubmitFeedbackTest(TestCase):
username
=
"test"
,
username
=
"test"
,
profile__name
=
"Test User"
profile__name
=
"Test User"
)
)
# This contains
an issue_type
to ensure that tags are submitted correctly
# This contains
issue_type and course_id
to ensure that tags are submitted correctly
self
.
_anon_fields
=
{
self
.
_anon_fields
=
{
"email"
:
"test@edx.org"
,
"email"
:
"test@edx.org"
,
"name"
:
"Test User"
,
"name"
:
"Test User"
,
"subject"
:
"a subject"
,
"subject"
:
"a subject"
,
"details"
:
"some details"
,
"details"
:
"some details"
,
"issue_type"
:
"test_issue"
"issue_type"
:
"test_issue"
,
"course_id"
:
"test_course"
}
}
# This does not contain
an issue_type to ensure that it is
optional
# This does not contain
issue_type nor course_id to ensure that they are
optional
self
.
_auth_fields
=
{
"subject"
:
"a subject"
,
"details"
:
"some details"
}
self
.
_auth_fields
=
{
"subject"
:
"a subject"
,
"details"
:
"some details"
}
def
_build_and_run_request
(
self
,
user
,
fields
):
def
_build_and_run_request
(
self
,
user
,
fields
):
...
@@ -112,6 +113,15 @@ class SubmitFeedbackTest(TestCase):
...
@@ -112,6 +113,15 @@ class SubmitFeedbackTest(TestCase):
resp
=
self
.
_build_and_run_request
(
user
,
fields
)
resp
=
self
.
_build_and_run_request
(
user
,
fields
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
def
_assert_datadog_called
(
self
,
datadog_mock
,
with_tags
):
expected_datadog_calls
=
[
mock
.
call
.
increment
(
views
.
DATADOG_FEEDBACK_METRIC
,
tags
=
([
"course_id:test_course"
,
"issue_type:test_issue"
]
if
with_tags
else
[])
)
]
self
.
assertEqual
(
datadog_mock
.
mock_calls
,
expected_datadog_calls
)
def
test_bad_request_anon_user_no_name
(
self
,
zendesk_mock_class
,
datadog_mock
):
def
test_bad_request_anon_user_no_name
(
self
,
zendesk_mock_class
,
datadog_mock
):
"""Test a request from an anonymous user not specifying `name`."""
"""Test a request from an anonymous user not specifying `name`."""
self
.
_test_bad_request_omit_field
(
self
.
_anon_user
,
self
.
_anon_fields
,
"name"
,
zendesk_mock_class
,
datadog_mock
)
self
.
_test_bad_request_omit_field
(
self
.
_anon_user
,
self
.
_anon_fields
,
"name"
,
zendesk_mock_class
,
datadog_mock
)
...
@@ -149,7 +159,7 @@ class SubmitFeedbackTest(TestCase):
...
@@ -149,7 +159,7 @@ class SubmitFeedbackTest(TestCase):
"requester"
:
{
"name"
:
"Test User"
,
"email"
:
"test@edx.org"
},
"requester"
:
{
"name"
:
"Test User"
,
"email"
:
"test@edx.org"
},
"subject"
:
"a subject"
,
"subject"
:
"a subject"
,
"comment"
:
{
"body"
:
"some details"
},
"comment"
:
{
"body"
:
"some details"
},
"tags"
:
[
"test_issue"
]
"tags"
:
[
"test_
course"
,
"test_
issue"
]
}
}
}
}
),
),
...
@@ -170,11 +180,8 @@ class SubmitFeedbackTest(TestCase):
...
@@ -170,11 +180,8 @@ class SubmitFeedbackTest(TestCase):
}
}
)
)
]
]
expected_datadog_calls
=
[
mock
.
call
.
increment
(
views
.
DATADOG_FEEDBACK_METRIC
,
tags
=
[
"issue_type:test_issue"
])
]
self
.
assertEqual
(
zendesk_mock_instance
.
mock_calls
,
expected_zendesk_calls
)
self
.
assertEqual
(
zendesk_mock_instance
.
mock_calls
,
expected_zendesk_calls
)
self
.
assertEqual
(
datadog_mock
.
mock_calls
,
expected_datadog_calls
)
self
.
_assert_datadog_called
(
datadog_mock
,
with_tags
=
True
)
def
test_bad_request_auth_user_no_subject
(
self
,
zendesk_mock_class
,
datadog_mock
):
def
test_bad_request_auth_user_no_subject
(
self
,
zendesk_mock_class
,
datadog_mock
):
"""Test a request from an authenticated user not specifying `subject`."""
"""Test a request from an authenticated user not specifying `subject`."""
...
@@ -225,11 +232,8 @@ class SubmitFeedbackTest(TestCase):
...
@@ -225,11 +232,8 @@ class SubmitFeedbackTest(TestCase):
}
}
)
)
]
]
expected_datadog_calls
=
[
mock
.
call
.
increment
(
views
.
DATADOG_FEEDBACK_METRIC
,
tags
=
[])
]
self
.
assertEqual
(
zendesk_mock_instance
.
mock_calls
,
expected_zendesk_calls
)
self
.
assertEqual
(
zendesk_mock_instance
.
mock_calls
,
expected_zendesk_calls
)
self
.
assertEqual
(
datadog_mock
.
mock_calls
,
expected_datadog_calls
)
self
.
_assert_datadog_called
(
datadog_mock
,
with_tags
=
False
)
def
test_get_request
(
self
,
zendesk_mock_class
,
datadog_mock
):
def
test_get_request
(
self
,
zendesk_mock_class
,
datadog_mock
):
"""Test that a GET results in a 405 even with all required fields"""
"""Test that a GET results in a 405 even with all required fields"""
...
@@ -255,10 +259,7 @@ class SubmitFeedbackTest(TestCase):
...
@@ -255,10 +259,7 @@ class SubmitFeedbackTest(TestCase):
resp
=
self
.
_build_and_run_request
(
self
.
_anon_user
,
self
.
_anon_fields
)
resp
=
self
.
_build_and_run_request
(
self
.
_anon_user
,
self
.
_anon_fields
)
self
.
assertEqual
(
resp
.
status_code
,
500
)
self
.
assertEqual
(
resp
.
status_code
,
500
)
self
.
assertFalse
(
resp
.
content
)
self
.
assertFalse
(
resp
.
content
)
expected_datadog_calls
=
[
self
.
_assert_datadog_called
(
datadog_mock
,
with_tags
=
True
)
mock
.
call
.
increment
(
views
.
DATADOG_FEEDBACK_METRIC
,
tags
=
[
"issue_type:test_issue"
])
]
self
.
assertEqual
(
datadog_mock
.
mock_calls
,
expected_datadog_calls
)
def
test_zendesk_error_on_update
(
self
,
zendesk_mock_class
,
datadog_mock
):
def
test_zendesk_error_on_update
(
self
,
zendesk_mock_class
,
datadog_mock
):
"""
"""
...
@@ -273,10 +274,7 @@ class SubmitFeedbackTest(TestCase):
...
@@ -273,10 +274,7 @@ class SubmitFeedbackTest(TestCase):
zendesk_mock_instance
.
update_ticket
.
side_effect
=
err
zendesk_mock_instance
.
update_ticket
.
side_effect
=
err
resp
=
self
.
_build_and_run_request
(
self
.
_anon_user
,
self
.
_anon_fields
)
resp
=
self
.
_build_and_run_request
(
self
.
_anon_user
,
self
.
_anon_fields
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
expected_datadog_calls
=
[
self
.
_assert_datadog_called
(
datadog_mock
,
with_tags
=
True
)
mock
.
call
.
increment
(
views
.
DATADOG_FEEDBACK_METRIC
,
tags
=
[
"issue_type:test_issue"
])
]
self
.
assertEqual
(
datadog_mock
.
mock_calls
,
expected_datadog_calls
)
@mock.patch.dict
(
"django.conf.settings.MITX_FEATURES"
,
{
"ENABLE_FEEDBACK_SUBMISSION"
:
False
})
@mock.patch.dict
(
"django.conf.settings.MITX_FEATURES"
,
{
"ENABLE_FEEDBACK_SUBMISSION"
:
False
})
def
test_not_enabled
(
self
,
zendesk_mock_class
,
datadog_mock
):
def
test_not_enabled
(
self
,
zendesk_mock_class
,
datadog_mock
):
...
...
common/djangoapps/util/views.py
View file @
7be6880f
...
@@ -175,7 +175,7 @@ def submit_feedback(request):
...
@@ -175,7 +175,7 @@ def submit_feedback(request):
subject
=
request
.
POST
[
"subject"
]
subject
=
request
.
POST
[
"subject"
]
details
=
request
.
POST
[
"details"
]
details
=
request
.
POST
[
"details"
]
tags
=
dict
(
tags
=
dict
(
[(
tag
,
request
.
POST
[
tag
])
for
tag
in
[
"issue_type"
]
if
tag
in
request
.
POST
]
[(
tag
,
request
.
POST
[
tag
])
for
tag
in
[
"issue_type"
,
"course_id"
]
if
tag
in
request
.
POST
]
)
)
if
request
.
user
.
is_authenticated
():
if
request
.
user
.
is_authenticated
():
...
...
lms/templates/help_modal.html
View file @
7be6880f
...
@@ -65,6 +65,9 @@ discussion_link = get_discussion_link(course) if course else None
...
@@ -65,6 +65,9 @@ discussion_link = get_discussion_link(course) if course else None
<span
class=
"tip"
>
Include error messages, steps which lead to the issue, etc
</span></label>
<span
class=
"tip"
>
Include error messages, steps which lead to the issue, etc
</span></label>
<textarea
name=
"details"
></textarea>
<textarea
name=
"details"
></textarea>
<input
name=
"issue_type"
type=
"hidden"
>
<input
name=
"issue_type"
type=
"hidden"
>
% if course:
<input
name=
"course_id"
type=
"hidden"
value=
"${course.id | h}"
>
% endif
<div
class=
"submit"
>
<div
class=
"submit"
>
<input
name=
"submit"
type=
"submit"
value=
"Submit"
>
<input
name=
"submit"
type=
"submit"
value=
"Submit"
>
</div>
</div>
...
...
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