Skip to content

Commit

Permalink
feat: update via SDK Studio (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 12, 2024
1 parent 27a1aca commit 1a1186d
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 320 deletions.
80 changes: 52 additions & 28 deletions tests/api_resources/alerting/v3s/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
"zones": ["string", "string", "string"],
},
mechanisms={
"foo": [
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
]
"email": [{"id": "test@example.com"}],
"pagerduty": [{"id": "e8133a15-00a4-4d69-aec1-32f70c51f6e5"}],
"webhooks": [{"id": "14cc1190-5d2b-4b98-a696-c424cb2ad05f"}],
},
name="SSL Notification Event Policy",
)
Expand Down Expand Up @@ -254,7 +252,11 @@ def test_method_notification_policies_create_a_notification_policy(self, client:
"023e105f4ecef8ad9ca31a8372d0c353",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
)
assert_matches_type(PolicyNotificationPoliciesCreateANotificationPolicyResponse, policy, path=["response"])
Expand All @@ -269,11 +271,9 @@ def test_method_notification_policies_create_a_notification_policy_with_all_para
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={
"foo": [
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
]
"email": [{"id": "test@example.com"}],
"pagerduty": [{"id": "e8133a15-00a4-4d69-aec1-32f70c51f6e5"}],
"webhooks": [{"id": "14cc1190-5d2b-4b98-a696-c424cb2ad05f"}],
},
name="SSL Notification Event Policy",
description="Something describing the policy.",
Expand Down Expand Up @@ -329,7 +329,11 @@ def test_raw_response_notification_policies_create_a_notification_policy(self, c
"023e105f4ecef8ad9ca31a8372d0c353",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
)

Expand All @@ -345,7 +349,11 @@ def test_streaming_response_notification_policies_create_a_notification_policy(s
"023e105f4ecef8ad9ca31a8372d0c353",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
) as response:
assert not response.is_closed
Expand All @@ -364,7 +372,11 @@ def test_path_params_notification_policies_create_a_notification_policy(self, cl
"",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
)

Expand Down Expand Up @@ -481,11 +493,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
"zones": ["string", "string", "string"],
},
mechanisms={
"foo": [
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
]
"email": [{"id": "test@example.com"}],
"pagerduty": [{"id": "e8133a15-00a4-4d69-aec1-32f70c51f6e5"}],
"webhooks": [{"id": "14cc1190-5d2b-4b98-a696-c424cb2ad05f"}],
},
name="SSL Notification Event Policy",
)
Expand Down Expand Up @@ -647,7 +657,11 @@ async def test_method_notification_policies_create_a_notification_policy(
"023e105f4ecef8ad9ca31a8372d0c353",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
)
assert_matches_type(PolicyNotificationPoliciesCreateANotificationPolicyResponse, policy, path=["response"])
Expand All @@ -662,11 +676,9 @@ async def test_method_notification_policies_create_a_notification_policy_with_al
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={
"foo": [
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
{"id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
]
"email": [{"id": "test@example.com"}],
"pagerduty": [{"id": "e8133a15-00a4-4d69-aec1-32f70c51f6e5"}],
"webhooks": [{"id": "14cc1190-5d2b-4b98-a696-c424cb2ad05f"}],
},
name="SSL Notification Event Policy",
description="Something describing the policy.",
Expand Down Expand Up @@ -724,7 +736,11 @@ async def test_raw_response_notification_policies_create_a_notification_policy(
"023e105f4ecef8ad9ca31a8372d0c353",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
)

Expand All @@ -742,7 +758,11 @@ async def test_streaming_response_notification_policies_create_a_notification_po
"023e105f4ecef8ad9ca31a8372d0c353",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
) as response:
assert not response.is_closed
Expand All @@ -764,7 +784,11 @@ async def test_path_params_notification_policies_create_a_notification_policy(
"",
alert_type="universal_ssl_event_type",
enabled=True,
mechanisms={"foo": [{}, {}, {}]},
mechanisms={
"email": [{}],
"pagerduty": [{}],
"webhooks": [{}],
},
name="SSL Notification Event Policy",
)
)
Expand Down
8 changes: 4 additions & 4 deletions tests/api_resources/devices/test_postures.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
expiration="1h",
input={
"exists": True,
"operating_system": "mac",
"operating_system": "linux",
"path": "/bin/cat",
"sha256": "https://api.us-2.crowdstrike.com",
"thumbprint": "0aabab210bdb998e9cf45da2c9ce352977ab531c681b74cf1e487be1bbe9fe6e",
Expand Down Expand Up @@ -174,7 +174,7 @@ def test_method_device_posture_rules_create_device_posture_rule_with_all_params(
expiration="1h",
input={
"exists": True,
"operating_system": "mac",
"operating_system": "linux",
"path": "/bin/cat",
"sha256": "https://api.us-2.crowdstrike.com",
"thumbprint": "0aabab210bdb998e9cf45da2c9ce352977ab531c681b74cf1e487be1bbe9fe6e",
Expand Down Expand Up @@ -333,7 +333,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
expiration="1h",
input={
"exists": True,
"operating_system": "mac",
"operating_system": "linux",
"path": "/bin/cat",
"sha256": "https://api.us-2.crowdstrike.com",
"thumbprint": "0aabab210bdb998e9cf45da2c9ce352977ab531c681b74cf1e487be1bbe9fe6e",
Expand Down Expand Up @@ -457,7 +457,7 @@ async def test_method_device_posture_rules_create_device_posture_rule_with_all_p
expiration="1h",
input={
"exists": True,
"operating_system": "mac",
"operating_system": "linux",
"path": "/bin/cat",
"sha256": "https://api.us-2.crowdstrike.com",
"thumbprint": "0aabab210bdb998e9cf45da2c9ce352977ab531c681b74cf1e487be1bbe9fe6e",
Expand Down
48 changes: 24 additions & 24 deletions tests/api_resources/dex/test_http_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def test_method_get(self, client: Cloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)
assert_matches_type(HTTPTestGetResponse, http_test, path=["response"])

Expand All @@ -41,8 +41,8 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
colo="string",
device_id=["string", "string", "string"],
)
Expand All @@ -55,8 +55,8 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)

assert response.is_closed is True
Expand All @@ -71,8 +71,8 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -90,17 +90,17 @@ def test_path_params_get(self, client: Cloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)

with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"):
client.dex.http_tests.with_raw_response.get(
"",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)


Expand All @@ -114,8 +114,8 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)
assert_matches_type(HTTPTestGetResponse, http_test, path=["response"])

Expand All @@ -126,8 +126,8 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
colo="string",
device_id=["string", "string", "string"],
)
Expand All @@ -140,8 +140,8 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)

assert response.is_closed is True
Expand All @@ -156,8 +156,8 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -175,15 +175,15 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
account_id="",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)

with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"):
await async_client.dex.http_tests.with_raw_response.get(
"",
account_id="01a7362d577a6c3019a474fd6f485823",
interval="minute",
time_end="1689606812000",
time_start="1689520412000",
time_end="string",
time_start="string",
)
Loading

0 comments on commit 1a1186d

Please sign in to comment.