-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_individuals.py
122 lines (101 loc) · 5.07 KB
/
test_individuals.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File generated from our OpenAPI spec by Stainless.
from __future__ import annotations
import os
import pytest
from finch import Finch, AsyncFinch
from tests.utils import assert_matches_type
from finch.pagination import SyncSinglePage, AsyncSinglePage
from finch.types.hris.benefits import (
IndividualBenefit,
EnrolledIndividual,
UnenrolledIndividual,
IndividualEnrolledIDsResponse,
)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
access_token = os.environ.get("API_KEY", "something1234")
class TestIndividuals:
strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True)
loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False)
parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"])
@parametrize
def test_method_enroll_many(self, client: Finch) -> None:
individual = client.hris.benefits.individuals.enroll_many(
"string",
individuals=[{}],
)
assert_matches_type(SyncSinglePage[EnrolledIndividual], individual, path=["response"])
@parametrize
def test_method_enrolled_ids(self, client: Finch) -> None:
individual = client.hris.benefits.individuals.enrolled_ids(
"string",
)
assert_matches_type(IndividualEnrolledIDsResponse, individual, path=["response"])
@parametrize
def test_method_retrieve_many_benefits(self, client: Finch) -> None:
individual = client.hris.benefits.individuals.retrieve_many_benefits(
"string",
)
assert_matches_type(SyncSinglePage[IndividualBenefit], individual, path=["response"])
@parametrize
def test_method_retrieve_many_benefits_with_all_params(self, client: Finch) -> None:
individual = client.hris.benefits.individuals.retrieve_many_benefits(
"string",
individual_ids="d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a",
)
assert_matches_type(SyncSinglePage[IndividualBenefit], individual, path=["response"])
@parametrize
def test_method_unenroll_many(self, client: Finch) -> None:
individual = client.hris.benefits.individuals.unenroll_many(
"string",
)
assert_matches_type(SyncSinglePage[UnenrolledIndividual], individual, path=["response"])
@parametrize
def test_method_unenroll_many_with_all_params(self, client: Finch) -> None:
individual = client.hris.benefits.individuals.unenroll_many(
"string",
individual_ids=["string", "string", "string"],
)
assert_matches_type(SyncSinglePage[UnenrolledIndividual], individual, path=["response"])
class TestAsyncIndividuals:
strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True)
loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False)
parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"])
@parametrize
async def test_method_enroll_many(self, client: AsyncFinch) -> None:
individual = await client.hris.benefits.individuals.enroll_many(
"string",
individuals=[{}],
)
assert_matches_type(AsyncSinglePage[EnrolledIndividual], individual, path=["response"])
@parametrize
async def test_method_enrolled_ids(self, client: AsyncFinch) -> None:
individual = await client.hris.benefits.individuals.enrolled_ids(
"string",
)
assert_matches_type(IndividualEnrolledIDsResponse, individual, path=["response"])
@parametrize
async def test_method_retrieve_many_benefits(self, client: AsyncFinch) -> None:
individual = await client.hris.benefits.individuals.retrieve_many_benefits(
"string",
)
assert_matches_type(AsyncSinglePage[IndividualBenefit], individual, path=["response"])
@parametrize
async def test_method_retrieve_many_benefits_with_all_params(self, client: AsyncFinch) -> None:
individual = await client.hris.benefits.individuals.retrieve_many_benefits(
"string",
individual_ids="d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a",
)
assert_matches_type(AsyncSinglePage[IndividualBenefit], individual, path=["response"])
@parametrize
async def test_method_unenroll_many(self, client: AsyncFinch) -> None:
individual = await client.hris.benefits.individuals.unenroll_many(
"string",
)
assert_matches_type(AsyncSinglePage[UnenrolledIndividual], individual, path=["response"])
@parametrize
async def test_method_unenroll_many_with_all_params(self, client: AsyncFinch) -> None:
individual = await client.hris.benefits.individuals.unenroll_many(
"string",
individual_ids=["string", "string", "string"],
)
assert_matches_type(AsyncSinglePage[UnenrolledIndividual], individual, path=["response"])