| 1 |
import json |
| 2 |
|
| 3 |
from globus_sdk.experimental import BookmarkCreateDocument |
| 4 |
from globus_sdk.testing import get_last_request, load_response |
| 5 |
|
| 6 |
|
| 7 |
def test_create_bookmark(client): |
| 8 |
meta = load_response(client.create_bookmark).metadata |
| 9 |
|
| 10 |
data = BookmarkCreateDocument( |
| 11 |
meta["collection"], |
| 12 |
meta["name"], |
| 13 |
meta["path"], |
| 14 |
) |
| 15 |
|
| 16 |
res = client.create_bookmark(data) |
| 17 |
|
| 18 |
assert res.http_status == 201 |
| 19 |
assert res["data"]["type"] == "Bookmark" |
| 20 |
|
| 21 |
req = get_last_request() |
| 22 |
sent = json.loads(req.body) |
| 23 |
assert sent["data"]["attributes"]["name"] == meta["name"] |
| 24 |
assert sent["data"]["attributes"]["path"] == meta["path"] |
| 25 |
assert ( |
| 26 |
sent["data"]["relationships"]["collection"]["data"]["id"] == meta["collection"] |
| 27 |
) |