-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_url_group.py
More file actions
47 lines (39 loc) · 1.34 KB
/
test_url_group.py
File metadata and controls
47 lines (39 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import pytest
from qstash import AsyncQStash
@pytest.mark.asyncio
async def test_url_group_async(async_client: AsyncQStash) -> None:
name = "python_url_group"
await async_client.url_group.delete(name)
await async_client.url_group.upsert_endpoints(
url_group=name,
endpoints=[
{"url": "https://mock.httpstatus.io/200"},
{"url": "https://mock.httpstatus.io/201"},
],
)
url_group = await async_client.url_group.get(name)
assert url_group.name == name
assert any(
True for e in url_group.endpoints if e.url == "https://mock.httpstatus.io/200"
)
assert any(
True for e in url_group.endpoints if e.url == "https://mock.httpstatus.io/201"
)
url_groups = await async_client.url_group.list()
assert any(True for ug in url_groups if ug.name == name)
await async_client.url_group.remove_endpoints(
url_group=name,
endpoints=[
{
"url": "https://mock.httpstatus.io/201",
}
],
)
url_group = await async_client.url_group.get(name)
assert url_group.name == name
assert any(
True for e in url_group.endpoints if e.url == "https://mock.httpstatus.io/200"
)
assert not any(
True for e in url_group.endpoints if e.url == "https://mock.httpstatus.io/201"
)