File: test_create_index.py

package info (click to toggle)
python-globus-sdk 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,172 kB
  • sloc: python: 35,227; sh: 44; makefile: 35
file content (24 lines) | stat: -rw-r--r-- 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pytest

import globus_sdk
from globus_sdk.testing import load_response


def test_create_index(client):
    meta = load_response(client.create_index).metadata

    res = client.create_index("Foo Title", "bar description")
    assert res.http_status == 200
    assert res["id"] == meta["index_id"]


def test_create_index_limit_exceeded(client):
    load_response(client.create_index, case="trial_limit")

    with pytest.raises(globus_sdk.SearchAPIError) as excinfo:
        client.create_index("Foo Title", "bar description")

    err = excinfo.value

    assert err.http_status == 409
    assert err.code == "Conflict.LimitExceeded"