Beispiel #1
0
def test_talk_proposal_create_form():
    form = TalkProposalCreateForm()
    assert list(form.fields) == [
        'title',
        'category',
        'duration',
        'language',
        'python_level',
        'recording_policy',
    ]
Beispiel #2
0
def test_talk_proposal_create_form_invalid_user(talk_proposal_data, request,
                                                invalid_user):
    request.user = invalid_user
    form = TalkProposalCreateForm(request=request, data=talk_proposal_data)
    assert not form.is_valid()
    assert form.errors == {
        '__all__': [
            'Only authenticated user with complete speaker profile may '
            'create a talk proposal.',
        ],
    }
Beispiel #3
0
def test_talk_proposal_create_form_valid(request, user):
    request.user = user
    form = TalkProposalCreateForm(request=request, data={
        'title': 'Beyond the Style Guides',
        'category': 'PRAC',
        'duration': 'PREF45',
        'language': 'CHI',
        'python_level': 'INTERMEDIATE',
        'recording_policy': True,
    })
    assert form.is_valid()
Beispiel #4
0
def test_talk_proposal_create_form_no_request():
    form = TalkProposalCreateForm(data={
        'title': 'Beyond the Style Guides',
        'category': 'PRAC',
        'duration': 'PREF45',
        'language': 'CHI',
        'python_level': 'INTERMEDIATE',
        'recording_policy': True,
    })
    assert not form.is_valid()
    assert form.errors == {
        '__all__': ['Proposal creation requires a request object.'],
    }
Beispiel #5
0
def test_talk_proposal_create_form():
    form = TalkProposalCreateForm()
    assert list(form.fields) == [
        'title',
        'category',
        'duration',
        'language',
        'python_level',
        'recording_policy',
        'live_stream_policy',
        'remoting_policy',
        'first_time_speaker',
        'referring_policy',
    ]
Beispiel #6
0
def test_talk_proposal_create_form_no_profile(request, bare_user):
    request.user = bare_user
    form = TalkProposalCreateForm(request=request, data={
        'title': 'Beyond the Style Guides',
        'category': 'PRAC',
        'duration': 'PREF45',
        'language': 'CHI',
        'python_level': 'INTERMEDIATE',
        'recording_policy': True,
    })
    assert not form.is_valid()
    assert form.errors == {
        '__all__': [
            'Only authenticated user with complete speaker profile may '
            'submit a proposal.',
        ],
    }
Beispiel #7
0
def test_talk_proposal_create_form_valid(talk_proposal_data, request, user):
    request.user = user
    form = TalkProposalCreateForm(request=request, data=talk_proposal_data)
    assert form.is_valid()
Beispiel #8
0
def test_talk_proposal_create_form_no_request(talk_proposal_data):
    form = TalkProposalCreateForm(data=talk_proposal_data)
    assert not form.is_valid()
    assert form.errors == {
        '__all__': ['Talk proposal creation requires a request object.'],
    }