Skip to content

Commit

Permalink
fix: func.__name__ issue (openedx#33133)
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram authored and Yagnesh committed Sep 1, 2023
1 parent 43c4876 commit 3b15fd6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lms/djangoapps/ccx/api/v0/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,19 +832,19 @@ def test_resolve_get_detail(self):
base_url = '{}/'.format(self.detail_url.rsplit('/', 1)[0])
# this url should be the same of the ccx list view
resolver = resolve(base_url)
assert views.CCXListView.__name__ == resolver.func.__name__
assert views.CCXListView.__name__ == resolver.func.view_class.__name__
assert views.CCXListView.__module__ == resolver.func.__module__
# invalid urls
for invalid_ccx_id in ('foo', 'ccx-v1:org.0', 'ccx-v1:org.0+course_0'):
with pytest.raises(Resolver404):
resolve(f'{base_url}{invalid_ccx_id}')
# the following course ID works even if it is not a CCX valid course id (the regex matches course ID strings)
resolver = resolve('{}{}'.format(base_url, 'ccx-v1:org.0+course_0+Run_0'))
assert views.CCXDetailView.__name__ == resolver.func.__name__
assert views.CCXDetailView.__name__ == resolver.func.view_class.__name__
assert views.CCXDetailView.__module__ == resolver.func.__module__
# and of course a valid ccx course id
resolver = resolve(f'{base_url}{self.ccx_key_str}')
assert views.CCXDetailView.__name__ == resolver.func.__name__
assert views.CCXDetailView.__name__ == resolver.func.view_class.__name__
assert views.CCXDetailView.__module__ == resolver.func.__module__

@ddt.data(
Expand Down

0 comments on commit 3b15fd6

Please sign in to comment.