Exemple #1
0
def _render_cpl(description,
                request,
                title,
                user,
                video_id,
                visit_function,
                video_id_next_class=None):
    if user.is_authenticated:
        visit_function(user, request.GET.get('utm_source', 'unknown'))

    launch_status = get_launch_status()
    if launch_status == LAUNCH_STATUS_PPL and not request.GET.get('debug'):
        return redirect(reverse('launch:landing_page'))

    if launch_status == LAUNCH_STATUS_OPEN_CART and not request.GET.get(
            'debug'):
        return redirect(reverse('checkout:bootcamp_lp'))

    ctx = {
        'data_href': f'https://{build_absolute_uri(request.path)}',
        'video_id': video_id,
        'video_id_next_class': video_id_next_class,
        'title': title,
        'description': description,
        'launch_status': launch_status,
        'opened_cpls': get_opened_cpls(),
        'DEBUG': settings.DEBUG,
    }
    return render(request, 'launch/cpl.html', ctx)
Exemple #2
0
def test_should_return_cpl1_to_2(mocker):
    mocker.patch('pythonpro.launch.facade.get_launch_status',
                 return_value=LAUNCH_STATUS_CPL2)
    assert get_opened_cpls() == ['cpl1', 'cpl2']