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
f8a3824b
Commit
f8a3824b
authored
Dec 20, 2017
by
Albert St. Aubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PR updates
parent
0a8f36c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
lms/djangoapps/commerce/tests/test_signals.py
+7
-4
lms/djangoapps/commerce/utils.py
+1
-0
No files found.
lms/djangoapps/commerce/tests/test_signals.py
View file @
f8a3824b
...
...
@@ -268,13 +268,14 @@ class TestRefundSignal(TestCase):
body
=
'I want a refund!'
,
tags
=
None
):
""" Call the create_zendesk_ticket function. """
tags
=
tags
or
[
'auto_refund'
]
create_zendesk_ticket
(
name
,
email
,
subject
,
body
,
tags
)
return
create_zendesk_ticket
(
name
,
email
,
subject
,
body
,
tags
)
@override_settings
(
ZENDESK_URL
=
ZENDESK_URL
,
ZENDESK_USER
=
None
,
ZENDESK_API_KEY
=
None
)
def
test_create_zendesk_ticket_no_settings
(
self
):
""" Verify the Zendesk API is not called if the settings are not all set. """
with
mock
.
patch
(
'requests.post'
)
as
mock_post
:
self
.
call_create_zendesk_ticket
()
success
=
self
.
call_create_zendesk_ticket
()
self
.
assertFalse
(
success
)
self
.
assertFalse
(
mock_post
.
called
)
def
test_create_zendesk_ticket_request_error
(
self
):
...
...
@@ -284,7 +285,8 @@ class TestRefundSignal(TestCase):
We simply need to ensure the exception is not raised beyond the function.
"""
with
mock
.
patch
(
'requests.post'
,
side_effect
=
Timeout
)
as
mock_post
:
self
.
call_create_zendesk_ticket
()
success
=
self
.
call_create_zendesk_ticket
()
self
.
assertFalse
(
success
)
self
.
assertTrue
(
mock_post
.
called
)
@httpretty.activate
...
...
@@ -297,7 +299,8 @@ class TestRefundSignal(TestCase):
subject
=
'Test Ticket'
body
=
'I want a refund!'
tags
=
[
'auto_refund'
]
self
.
call_create_zendesk_ticket
(
name
,
email
,
subject
,
body
,
tags
)
ticket_created
=
self
.
call_create_zendesk_ticket
(
name
,
email
,
subject
,
body
,
tags
)
self
.
assertTrue
(
ticket_created
)
last_request
=
httpretty
.
last_request
()
# Verify the headers
...
...
lms/djangoapps/commerce/utils.py
View file @
f8a3824b
...
...
@@ -376,3 +376,4 @@ def create_zendesk_ticket(requester_name, requester_email, subject, body, tags=N
except
Exception
:
# pylint: disable=broad-except
log
.
exception
(
'Failed to create ticket.'
)
return
False
return
True
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