add test cases to ensure actions enabled is correctly returned
This commit is contained in:
parent
1fdb0e987d
commit
50974aa9b2
@ -101,15 +101,22 @@ def test_describe_alarms():
|
|||||||
conn.create_alarm(alarm_fixture(name="nfoobaz", action="afoobaz"))
|
conn.create_alarm(alarm_fixture(name="nfoobaz", action="afoobaz"))
|
||||||
conn.create_alarm(alarm_fixture(name="nbarfoo", action="abarfoo"))
|
conn.create_alarm(alarm_fixture(name="nbarfoo", action="abarfoo"))
|
||||||
conn.create_alarm(alarm_fixture(name="nbazfoo", action="abazfoo"))
|
conn.create_alarm(alarm_fixture(name="nbazfoo", action="abazfoo"))
|
||||||
|
|
||||||
|
enabled = alarm_fixture(name="enabled1", action=["abarfoo"])
|
||||||
|
enabled.add_alarm_action("arn:alarm")
|
||||||
|
conn.create_alarm(enabled)
|
||||||
|
|
||||||
alarms = conn.describe_alarms()
|
alarms = conn.describe_alarms()
|
||||||
alarms.should.have.length_of(4)
|
alarms.should.have.length_of(5)
|
||||||
alarms = conn.describe_alarms(alarm_name_prefix="nfoo")
|
alarms = conn.describe_alarms(alarm_name_prefix="nfoo")
|
||||||
alarms.should.have.length_of(2)
|
alarms.should.have.length_of(2)
|
||||||
alarms = conn.describe_alarms(alarm_names=["nfoobar", "nbarfoo", "nbazfoo"])
|
alarms = conn.describe_alarms(alarm_names=["nfoobar", "nbarfoo", "nbazfoo"])
|
||||||
alarms.should.have.length_of(3)
|
alarms.should.have.length_of(3)
|
||||||
alarms = conn.describe_alarms(action_prefix="afoo")
|
alarms = conn.describe_alarms(action_prefix="afoo")
|
||||||
alarms.should.have.length_of(2)
|
alarms.should.have.length_of(2)
|
||||||
|
alarms = conn.describe_alarms(alarm_name_prefix="enabled")
|
||||||
|
alarms.should.have.length_of(1)
|
||||||
|
alarms[0].actions_enabled.should.equal("true")
|
||||||
|
|
||||||
for alarm in conn.describe_alarms():
|
for alarm in conn.describe_alarms():
|
||||||
alarm.delete()
|
alarm.delete()
|
||||||
@ -117,7 +124,6 @@ def test_describe_alarms():
|
|||||||
alarms = conn.describe_alarms()
|
alarms = conn.describe_alarms()
|
||||||
alarms.should.have.length_of(0)
|
alarms.should.have.length_of(0)
|
||||||
|
|
||||||
|
|
||||||
@mock_cloudwatch_deprecated
|
@mock_cloudwatch_deprecated
|
||||||
def test_get_metric_statistics():
|
def test_get_metric_statistics():
|
||||||
conn = boto.connect_cloudwatch()
|
conn = boto.connect_cloudwatch()
|
||||||
|
@ -104,6 +104,7 @@ def test_alarm_state():
|
|||||||
Statistic="Average",
|
Statistic="Average",
|
||||||
Threshold=2,
|
Threshold=2,
|
||||||
ComparisonOperator="GreaterThanThreshold",
|
ComparisonOperator="GreaterThanThreshold",
|
||||||
|
ActionsEnabled=True,
|
||||||
)
|
)
|
||||||
client.put_metric_alarm(
|
client.put_metric_alarm(
|
||||||
AlarmName="testalarm2",
|
AlarmName="testalarm2",
|
||||||
@ -128,19 +129,18 @@ def test_alarm_state():
|
|||||||
len(resp["MetricAlarms"]).should.equal(1)
|
len(resp["MetricAlarms"]).should.equal(1)
|
||||||
resp["MetricAlarms"][0]["AlarmName"].should.equal("testalarm1")
|
resp["MetricAlarms"][0]["AlarmName"].should.equal("testalarm1")
|
||||||
resp["MetricAlarms"][0]["StateValue"].should.equal("ALARM")
|
resp["MetricAlarms"][0]["StateValue"].should.equal("ALARM")
|
||||||
resp["MetricAlarms"][0]["ActionsEnabled"].should.equal("True")
|
resp["MetricAlarms"][0]["ActionsEnabled"].should.equal(True)
|
||||||
|
|
||||||
resp = client.describe_alarms(StateValue="OK")
|
resp = client.describe_alarms(StateValue="OK")
|
||||||
len(resp["MetricAlarms"]).should.equal(1)
|
len(resp["MetricAlarms"]).should.equal(1)
|
||||||
resp["MetricAlarms"][0]["AlarmName"].should.equal("testalarm2")
|
resp["MetricAlarms"][0]["AlarmName"].should.equal("testalarm2")
|
||||||
resp["MetricAlarms"][0]["StateValue"].should.equal("OK")
|
resp["MetricAlarms"][0]["StateValue"].should.equal("OK")
|
||||||
resp["MetricAlarms"][0]["ActionsEnabled"].should.equal("True")
|
resp["MetricAlarms"][0]["ActionsEnabled"].should.equal(False)
|
||||||
|
|
||||||
# Just for sanity
|
# Just for sanity
|
||||||
resp = client.describe_alarms()
|
resp = client.describe_alarms()
|
||||||
len(resp["MetricAlarms"]).should.equal(2)
|
len(resp["MetricAlarms"]).should.equal(2)
|
||||||
|
|
||||||
|
|
||||||
@mock_cloudwatch
|
@mock_cloudwatch
|
||||||
def test_put_metric_data_no_dimensions():
|
def test_put_metric_data_no_dimensions():
|
||||||
conn = boto3.client("cloudwatch", region_name="us-east-1")
|
conn = boto3.client("cloudwatch", region_name="us-east-1")
|
||||||
|
Loading…
Reference in New Issue
Block a user