Scheduler: Fix update_schedule raising ResourceNotFound errors when using schedule groups (#6269)
This commit is contained in:
parent
e2d3582471
commit
e5e1521523
@ -60,7 +60,7 @@ class EventBridgeSchedulerResponse(BaseResponse):
|
|||||||
return "{}"
|
return "{}"
|
||||||
|
|
||||||
def update_schedule(self) -> str:
|
def update_schedule(self) -> str:
|
||||||
group_name = self._get_param("groupName")
|
group_name = self._get_param("GroupName")
|
||||||
name = self.uri.split("?")[0].split("/")[-1]
|
name = self.uri.split("?")[0].split("/")[-1]
|
||||||
description = self._get_param("Description")
|
description = self._get_param("Description")
|
||||||
end_date = self._get_param("EndDate")
|
end_date = self._get_param("EndDate")
|
||||||
|
@ -81,11 +81,22 @@ def test_create_get_delete__in_different_group():
|
|||||||
assert err["Code"] == "ResourceNotFoundException"
|
assert err["Code"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"extra_kwargs",
|
||||||
|
[
|
||||||
|
({}),
|
||||||
|
({"GroupName": "some-group"}),
|
||||||
|
],
|
||||||
|
ids=["without_group", "with_group"],
|
||||||
|
)
|
||||||
@mock_scheduler
|
@mock_scheduler
|
||||||
def test_update_schedule():
|
def test_update_schedule(extra_kwargs):
|
||||||
client = boto3.client("scheduler", region_name="eu-west-1")
|
client = boto3.client("scheduler", region_name="eu-west-1")
|
||||||
|
|
||||||
|
client.create_schedule_group(Name="some-group")
|
||||||
|
|
||||||
client.create_schedule(
|
client.create_schedule(
|
||||||
|
**extra_kwargs,
|
||||||
Name="my-schedule",
|
Name="my-schedule",
|
||||||
ScheduleExpression="some cron",
|
ScheduleExpression="some cron",
|
||||||
FlexibleTimeWindow={
|
FlexibleTimeWindow={
|
||||||
@ -99,6 +110,7 @@ def test_update_schedule():
|
|||||||
)
|
)
|
||||||
|
|
||||||
client.update_schedule(
|
client.update_schedule(
|
||||||
|
**extra_kwargs,
|
||||||
Name="my-schedule",
|
Name="my-schedule",
|
||||||
Description="new desc",
|
Description="new desc",
|
||||||
ScheduleExpression="new cron",
|
ScheduleExpression="new cron",
|
||||||
@ -113,7 +125,7 @@ def test_update_schedule():
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
schedule = client.get_schedule(Name="my-schedule")
|
schedule = client.get_schedule(**extra_kwargs, Name="my-schedule")
|
||||||
assert schedule["Description"] == "new desc"
|
assert schedule["Description"] == "new desc"
|
||||||
assert schedule["ScheduleExpression"] == "new cron"
|
assert schedule["ScheduleExpression"] == "new cron"
|
||||||
assert schedule["State"] == "DISABLED"
|
assert schedule["State"] == "DISABLED"
|
||||||
|
Loading…
Reference in New Issue
Block a user