コード例 #1
0
def test_patch(client):
    """Can we PATCH an existing resource?"""
    response = client.patch(
        '/artist/1',
        data=json.dumps({'Name': 'Jeff Knupp'}),
        headers={'Content-type': 'application/json'},
    )
    assert response.status_code == 200
コード例 #2
0
ファイル: test_sandman2.py プロジェクト: darthlupi/sandman2
def test_patch(client):
    """Can we PATCH an existing resource?"""
    response = client.patch(
        '/artist/1',
        data=json.dumps({'Name': 'Jeff Knupp'}),
        headers={'Content-type': 'application/json'},
        )
    assert response.status_code == 200
コード例 #3
0
def test_validate_patch(client):
    """Do we get back an error message when making a PATCH request on an
    existing resource?"""
    response = client.patch('/user/1',
                            data=json.dumps({
                                'name': 'Jeff Knupp',
                            }),
                            headers={'Content-Type': 'application/json'})
    assert response.status_code == 400
    assert response.json['message'] == INVALID_ACTION_MESSAGE
コード例 #4
0
ファイル: test_user_models.py プロジェクト: 01-/sandman2
def test_validate_patch(client):
    """Do we get back an error message when making a PATCH request on an
    existing resource?"""
    response = client.patch(
        '/user/1',
        data=json.dumps({
            'name': 'Jeff Knupp',
            }),
        headers={'Content-Type': 'application/json'}
    )
    assert response.status_code == 400
    assert response.json['message'] == INVALID_ACTION_MESSAGE
コード例 #5
0
def test_patch_no_data(client):
    """Do we get an error if we try to PATCH a non-existent resource?"""
    response = client.patch('/artist/1', )
    assert response.status_code == 400