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
8fc31b42
Commit
8fc31b42
authored
May 11, 2017
by
asadiqbal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENT-374 Support ticket is created without enterprise tags for Anonymous users.
parent
6d1c23b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
common/djangoapps/util/tests/test_submit_feedback.py
+42
-0
openedx/features/enterprise_support/api.py
+3
-0
No files found.
common/djangoapps/util/tests/test_submit_feedback.py
View file @
8fc31b42
...
...
@@ -520,6 +520,48 @@ class SubmitFeedbackTest(EnterpriseServiceMockMixin, TestCase):
self
.
_assert_zendesk_called
(
zendesk_mock_instance
,
ticket_id
,
ticket
,
ticket_update
)
self
.
_assert_datadog_called
(
datadog_mock
,
datadog_tags
)
@httpretty.activate
@override_settings
(
ZENDESK_CUSTOM_FIELDS
=
TEST_ZENDESK_CUSTOM_FIELD_CONFIG
,
ENABLE_ENTERPRISE_INTEGRATION
=
True
)
def
test_request_with_anonymous_user_without_enterprise_info
(
self
,
zendesk_mock_class
,
datadog_mock
):
"""
Test tags related to enterprise should not be there in case an unauthenticated user.
"""
ticket_id
=
42
self
.
mock_enterprise_learner_api
()
user
=
self
.
_anon_user
zendesk_mock_instance
=
zendesk_mock_class
.
return_value
zendesk_mock_instance
.
create_ticket
.
return_value
=
ticket_id
datadog_valid_tags
=
[
"issue_type:{}"
.
format
(
self
.
_anon_fields
[
"issue_type"
])]
datadog_invalid_tags
=
[
'learner_type:enterprise_learner'
]
resp
=
self
.
_build_and_run_request
(
user
,
self
.
_anon_fields
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
expected_datadog_calls
=
[
mock
.
call
.
increment
(
views
.
DATADOG_FEEDBACK_METRIC
,
tags
=
datadog_valid_tags
)]
self
.
assertEqual
(
datadog_mock
.
mock_calls
,
expected_datadog_calls
)
not_expected_datadog_calls
=
[
mock
.
call
.
increment
(
views
.
DATADOG_FEEDBACK_METRIC
,
tags
=
datadog_invalid_tags
)]
self
.
assertNotEqual
(
datadog_mock
.
mock_calls
,
not_expected_datadog_calls
)
@httpretty.activate
@override_settings
(
ZENDESK_CUSTOM_FIELDS
=
TEST_ZENDESK_CUSTOM_FIELD_CONFIG
,
ENABLE_ENTERPRISE_INTEGRATION
=
True
)
def
test_tags_in_request_with_auth_user_with_enterprise_info
(
self
,
zendesk_mock_class
,
datadog_mock
):
"""
Test tags related to enterprise should be there in case the request is generated by an authenticated user.
"""
ticket_id
=
42
self
.
mock_enterprise_learner_api
()
user
=
self
.
_auth_user
zendesk_mock_instance
=
zendesk_mock_class
.
return_value
zendesk_mock_instance
.
create_ticket
.
return_value
=
ticket_id
datadog_valid_tags
=
[
'learner_type:enterprise_learner'
]
resp
=
self
.
_build_and_run_request
(
user
,
self
.
_auth_fields
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
_assert_datadog_called
(
datadog_mock
,
datadog_valid_tags
)
def
test_get_request
(
self
,
zendesk_mock_class
,
datadog_mock
):
"""Test that a GET results in a 405 even with all required fields"""
req
=
self
.
_request_factory
.
get
(
"/submit_feedback"
,
data
=
self
.
_anon_fields
)
...
...
openedx/features/enterprise_support/api.py
View file @
8fc31b42
...
...
@@ -162,6 +162,9 @@ class EnterpriseApiClient(object):
a response. This exception is raised for both connection timeout and read timeout.
"""
if
not
user
.
is_authenticated
():
return
None
api_resource_name
=
'enterprise-learner'
cache_key
=
get_cache_key
(
...
...
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