def test_bulk_operations(site, client):
    dev_uri = site.list_uri('device')
    ifc_uri = site.list_uri('interface')

    dev_resp = client.create(dev_uri, hostname='foo-bar1')
    dev = get_result(dev_resp)

    # Successfully create a collection of Interfaces
    collection = [
        {'device': dev['id'], 'name': 'foo1'},
        {'device': dev['id'], 'name': 'foo2'},
        {'device': dev['id'], 'name': 'foo3'},
    ]
    collection_response = client.post(
        ifc_uri,
        data=json.dumps(collection)
    )
    assert_created(collection_response, None)

    # Successfully get all created Interfaces
    output = collection_response.json()
    expected = get_result(output)

    assert_success(client.get(ifc_uri), expected)

    # Test update of all created Interfaces (name: foo => bar)
    updated = copy.deepcopy(expected)
    for item in updated:
        item['name'] = item['name'].replace('foo', 'bar')
    updated_resp = client.put(ifc_uri, data=json.dumps(updated))
    expected = updated_resp.json()

    assert updated == expected
Test creating/updating multiple Interfaces at once.
dataset/ETHPy150Open dropbox/nsot/tests/api_tests/test_interfaces.py/test_bulk_operations