Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Add id_field attribute to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thallada committed Apr 20, 2017
1 parent e584a3b commit af5e843
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions analyticsclient/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class APIListTestCase(object):

# Override in the subclass:
endpoint = 'list'
id_field = 'id'

def setUp(self):
"""Set up the test case."""
Expand Down Expand Up @@ -74,9 +75,9 @@ def test_all_items_url(self):
['edx/demo/course'],
['edx/demo/course', 'another/demo/course']
)
def test_courses_ids(self, course_ids):
"""Endpoint can be called with course IDs."""
self.kwarg_test(course_ids=course_ids)
def test_courses_ids(self, ids):
"""Endpoint can be called with IDs."""
self.kwarg_test(**{self.id_field: ids})

@ddt.data(
['course_id'],
Expand All @@ -100,6 +101,6 @@ def test_exclude(self, exclude):
['created', 'pacing_type'])
)
@ddt.unpack
def test_all_parameters(self, course_ids, fields, exclude):
def test_all_parameters(self, ids, fields, exclude):
"""Endpoint can be called with all parameters."""
self.kwarg_test(course_ids=course_ids, fields=fields, exclude=exclude)
self.kwarg_test(**{self.id_field: ids, 'fields': fields, 'exclude': exclude})
1 change: 1 addition & 0 deletions analyticsclient/tests/test_course_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class CourseSummariesTests(APIListTestCase, ClientTestCase):

endpoint = 'course_summaries'
id_field = 'course_ids'

@ddt.data(
['123'],
Expand Down
1 change: 1 addition & 0 deletions analyticsclient/tests/test_programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
class ProgramsTests(APIListTestCase, ClientTestCase):

endpoint = 'programs'
id_field = 'program_ids'

0 comments on commit af5e843

Please sign in to comment.