Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
dac255c9
Commit
dac255c9
authored
Mar 15, 2016
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed httpretty
ECOM-3895
parent
4bf140a7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
course_discovery/apps/courses/tests/test_refresh_all_courses.py
+0
-3
docs/testing.rst
+11
-0
requirements/test.txt
+0
-1
No files found.
course_discovery/apps/courses/tests/test_refresh_all_courses.py
View file @
dac255c9
...
...
@@ -4,7 +4,6 @@ from django.core.management import call_command
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
edx_rest_api_client.client
import
EdxRestApiClient
import
httpretty
from
mock
import
patch
from
course_discovery.apps.courses.models
import
Course
...
...
@@ -27,7 +26,6 @@ class RefreshAllCoursesCommandTests(TestCase):
call_command
(
self
.
cmd
,
access_token
=
access_token
)
mock_refresh
.
assert_called_once_with
(
access_token
=
access_token
)
@httpretty.activate
def
test_call_with_client_credentials
(
self
):
""" Verify the management command calls Course.refresh_all() with client credentials. """
access_token
=
'secret'
...
...
@@ -38,7 +36,6 @@ class RefreshAllCoursesCommandTests(TestCase):
call_command
(
self
.
cmd
)
mock_refresh
.
assert_called_once_with
(
access_token
=
access_token
)
@httpretty.activate
def
test_call_with_client_credentials_error
(
self
):
""" Verify the command requires an access token to complete. """
with
patch
.
object
(
EdxRestApiClient
,
'get_oauth_access_token'
)
as
mock_access_token
:
...
...
docs/testing.rst
View file @
dac255c9
...
...
@@ -12,3 +12,14 @@ Code quality validation can be run independently with:
.. code-block:: bash
$ make quality
httpretty
---------
edX uses `httpretty <http://httpretty.readthedocs.org/en/latest/>`_ a lot to mock HTTP endpoints; however,
`a bug in httpretty <https://github.com/gabrielfalcao/HTTPretty/issues/65>`_ (that is closed, but still a problem)
prevents us from using it in this repository. Were you to use `httpretty`, you would find that, although you might
mock an OAuth2 endpoint, `httpretty` blocks requests to Elasticsearch, leading to test failures.
Given our extensive use of Elasticsearch, and need to mock HTTP endpoints, we use the
`responses <https://github.com/getsentry/responses>`_ library. It's API is practically the same as that of `httpretty.
requirements/test.txt
View file @
dac255c9
...
...
@@ -7,7 +7,6 @@ django-dynamic-fixture==1.8.5
django-nose==1.4.2
edx-lint==0.5.0
factory-boy==2.6.0
httpretty==0.8.14
mock==1.3.0
nose-ignore-docstring==0.2
pep8==1.6.2
...
...
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