'Test for the ccx detail view resolver. This is needed because it is assumed
that only an URL with a valid course id string can reach the detail view.'

def test_resolve_get_detail(self):

    base_url = '{0}/'.format(self.detail_url.rsplit('/', 1)[0])
    resolver = resolve(base_url)
    self.assertEqual(views.CCXListView.__name__, resolver.func.__name__)
    self.assertEqual(views.CCXListView.__module__, resolver.func.__module__)
    for invalid_ccx_id in ('foo', 'ccx-v1:org.0', 'ccx-v1:org.0+course_0'):
        with self.assertRaises(Resolver404):
            resolve('{0}{1}'.format(base_url, invalid_ccx_id))
    resolver = resolve('{0}{1}'.format(base_url, 'ccx-v1:org.0+course_0+Run_0'))
    self.assertEqual(views.CCXDetailView.__name__, resolver.func.__name__)
    self.assertEqual(views.CCXDetailView.__module__, resolver.func.__module__)
    resolver = resolve('{0}{1}'.format(base_url, self.ccx_key_str))
    self.assertEqual(views.CCXDetailView.__name__, resolver.func.__name__)
    self.assertEqual(views.CCXDetailView.__module__, resolver.func.__module__)
