def test_enroll_user_view(rf, user): from core.models import Course from core.views import EnrollCourseView course = mommy.make('Course', slug='acceptance_enroll_user') lesson = mommy.make('Lesson', course=course, slug='lesson') request = rf.get('/courses/' + course.slug + '/enroll/') request.user = user view = EnrollCourseView(request=request) view.kwargs = {'slug': course.slug} assert view.get_object().id == Course.objects.get(slug=course.slug).id response = view.get(request) assert response.status_code == 302 assert response['Location'] == '/course/' + course.slug + '/lesson/' + lesson.slug + '/'
def test_enroll_user_view(rf, user): from core.models import Course from core.views import EnrollCourseView course = mommy.make('Course', slug='acceptance_enroll_user') lesson = mommy.make('Lesson', course=course, slug='lesson') request = rf.get('/courses/' + course.slug + '/enroll/') request.user = user view = EnrollCourseView(request=request) view.kwargs = {'slug': course.slug} assert view.get_object().id == Course.objects.get(slug=course.slug).id response = view.get(request) assert response.status_code == 302 assert response[ 'Location'] == '/course/' + course.slug + '/lesson/' + lesson.slug + '/'
url(r'^certificate/(?P<slug>[-a-zA-Z0-9_]+)/$', CourseCertificationDetailView.as_view(), name='certificate'), url(r'^certificate/(?P<slug>[-a-zA-Z0-9_]+)/print/$', CourseCertificationDetailView.as_view( template_name="certificate_print.html"), name='certificate-print'), url(r'^certificate/(?P<slug>[-a-zA-Z0-9_]+)/download/$', CourseCertificationDetailView.as_view(), name='certificate-download'), url(r'^accept_terms/$', AcceptTermsView.as_view(), name='accept_terms'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/intro/$', CourseView.as_view(), name='course_intro'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/enroll/$', EnrollCourseView.as_view(), name='enroll_course'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/resume/$', ResumeCourseView.as_view(), name='resume_course'), url(r'^course/(?P<course_slug>[-a-zA-Z0-9_]+)/lesson/(?P<slug>[-a-zA-Z0-9_]+)/$', LessonDetailView.as_view(), name='lesson'), url(r'^html5/', TemplateView.as_view(template_name="html5.html")), url(r'^empty/', TemplateView.as_view(template_name="empty.html")), url(r'^contact/?$', ContactView.as_view(), name="contact"), # Classes url(r'^course/(?P<course_slug>[-a-zA-Z0-9_]+)/classes/$', ClassListView.as_view(), name='classes'),
'', url(r'^$', HomeView.as_view(), name='home_view'), url(r'^courses', CoursesView.as_view(), name='courses'), # Uncomment the next line to enable the admin: url(r'^django/admin/doc/', include('django.contrib.admindocs.urls')), url(r'^django/admin/', include(django_admin.site.urls)), # Privileged browsing url(r'^admin/', include('administration.urls')), # Public browsing url(r'^my-courses/$', UserCoursesView.as_view(), name='user_courses'), url(r'^accept_terms/$', AcceptTermsView.as_view(), name='accept_terms'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/intro/$', CourseView.as_view(), name='course_intro'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/enroll/$', EnrollCourseView.as_view(), name='enroll_course'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/resume/$', ResumeCourseView.as_view(), name='resume_course'), url(r'^course/(?P<course_slug>[-a-zA-Z0-9_]+)/lesson/(?P<slug>[-a-zA-Z0-9_]+)/$', LessonDetailView.as_view(), name='lesson'), url(r'^html5/', TemplateView.as_view(template_name="html5.html")), url(r'^empty/', TemplateView.as_view(template_name="empty.html")), url(r'^contact/?$', ContactView.as_view(), name="contact"), # Classes url(r'^course/(?P<course_slug>[-a-zA-Z0-9_]+)/classes/$', ClassListView.as_view(), name='classes'), url(r'^class/create/$', ClassCreateView.as_view(), name='class-create'), url(r'^class/(?P<pk>[0-9]+)/$', ClassUpdateView.as_view(), name='class'), url(r'^class/(?P<pk>[0-9]+)/delete/$', ClassDeleteView.as_view(), name='class-delete'), url(r'^class/(?P<pk>[0-9]+)/remove_user/$', ClassRemoveUserView.as_view(), name='class-remove-user'), url(r'^class/(?P<pk>[0-9]+)/add_users/$', ClassAddUsersView.as_view(), name='class-add-users'),
url(r'^integration/connect$', csrf_exempt(IntegrationController.as_view()), name='integration_connect'), url(r'^emit_recipt/(?P<course_id>[-a-zA-Z0-9_]+)$', EmitReceiptView.as_view(), name='emit_recipt'), url(r'^request_certificate/(?P<course_id>[-a-zA-Z0-9_]+)$', RequestCertificateView.as_view(), name='request_certificate'), url(r'^certificate/(?P<slug>[-a-zA-Z0-9_]+)/?$', CourseCertificationDetailView.as_view(), name='certificate'), url(r'^certificate/(?P<slug>[-a-zA-Z0-9_]+)/print/?$', CourseCertificationDetailView.as_view(template_name="certificate_print.html"), name='certificate-print'), url(r'^certificate/(?P<slug>[-a-zA-Z0-9_]+)/download/?$', CourseCertificationDetailView.as_view(), name='certificate-download'), url(r'^accept_terms/?$', AcceptTermsView.as_view(), name='accept_terms'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/intro/?$', CourseView.as_view(), name='course_intro'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/enroll/?$', EnrollCourseView.as_view(), name='enroll_course'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/resume/?$', ResumeCourseView.as_view(), name='resume_course'), url(r'^course/(?P<slug>[-a-zA-Z0-9_]+)/go-out/?$', GoOutCourseView.as_view(), name='go_out_course'), url(r'^course/(?P<course_slug>[-a-zA-Z0-9_]+)/lesson/(?P<slug>[-a-zA-Z0-9_]+)/?$', LessonDetailView.as_view(), name='lesson'), url(r'^html5/', TemplateView.as_view(template_name="html5.html")), url(r'^empty/', TemplateView.as_view(template_name="empty.html")), url(r'^contact/?$', ContactView.as_view(), name="contact"), # Classes url(r'^course/(?P<course_slug>[-a-zA-Z0-9_]+)/classes/?$', ClassListView.as_view(), name='classes'), url(r'^class/create/?$', ClassCreateView.as_view(), name='class-create'), url(r'^class/(?P<pk>[0-9]+)/?$', ClassUpdateView.as_view(), name='class'), url(r'^class/(?P<pk>[0-9]+)/delete/?$', ClassDeleteView.as_view(), name='class-delete'), url(r'^class/(?P<pk>[0-9]+)/remove_user/?$', ClassRemoveUserView.as_view(), name='class-remove-user'), url(r'^class/(?P<pk>[0-9]+)/evaluations/?$', ClassEvaluationsView.as_view(), name='class-evaluations'),