示例#1
0
def test_cancelled_signups_not_visible_by_default(user_api_client):
    cancelled_signup = SignupFactory(user=user_api_client.user,
                                     cancelled_at=now())

    list_data = get(user_api_client, LIST_URL)
    assert len(list_data['results']) == 0

    get(user_api_client, get_detail_url(cancelled_signup), 404)
示例#2
0
def test_user_can_see_only_own_signups(user_api_client, signup):
    other_user_signup = SignupFactory()

    data = get(user_api_client, LIST_URL)
    results = data['results']
    assert len(results) == 1
    assert results[0]['id'] == signup.id

    get(user_api_client, get_detail_url(other_user_signup), status_code=404)
示例#3
0
def test_target_filter(user_api_client, signup):
    other_target_signup = SignupFactory(user=user_api_client.user)

    list_data = get(user_api_client, LIST_URL)
    assert len(list_data['results']) == 2

    list_data = get(
        user_api_client,
        LIST_URL + '?target={}'.format(other_target_signup.target.identifier))
    assert len(list_data['results']) == 1
    assert list_data['results'][0]['id'] == other_target_signup.id
示例#4
0
def test_include_cancelled_filter(user_api_client, signup, true_value):
    cancelled_signup = SignupFactory(user=user_api_client.user,
                                     cancelled_at=now())

    list_data = get(
        user_api_client,
        LIST_URL + '?include_cancelled{}&foo=bar'.format(true_value))
    assert len(list_data['results']) == 2

    list_data = get(user_api_client, LIST_URL + '?include_cancelled=false')
    assert len(list_data['results']) == 1
    assert list_data['results'][0]['id'] != cancelled_signup.id

    detail_data = get(
        user_api_client,
        get_detail_url(cancelled_signup) +
        '?include_cancelled{}'.format(true_value))
    assert detail_data['id'] == cancelled_signup.id
def test_get_signup_target_detail(api_client, signup_target):
    signup_target_data = get(api_client, get_detail_url(signup_target))
    check_signup_target_data(signup_target_data, signup_target)
def test_get_signup_target_list(api_client, signup_target):
    data = get(api_client, LIST_URL)
    signup_target_data = data['results'][0]
    check_signup_target_data(signup_target_data, signup_target)
示例#7
0
def test_get_signup_detail(user_api_client, signup):
    signup_data = get(user_api_client, get_detail_url(signup))
    check_signup_data(signup_data, signup)
示例#8
0
def test_get_signup_list(user_api_client, signup):
    data = get(user_api_client, LIST_URL)
    signup_data = data['results'][0]
    check_signup_data(signup_data, signup)
示例#9
0
def test_unauthenticated_user_cannot_access(api_client):
    get(api_client, LIST_URL, 401)