This commit is contained in:
Steve Pulec 2017-02-23 21:37:43 -05:00
commit f37bad0e00
260 changed files with 6363 additions and 3766 deletions

View file

@ -4,6 +4,7 @@ import sure # noqa
from moto import mock_cloudwatch_deprecated
def alarm_fixture(name="tester", action=None):
action = action or ['arn:alarm']
return MetricAlarm(
@ -23,6 +24,7 @@ def alarm_fixture(name="tester", action=None):
unit='Seconds',
)
@mock_cloudwatch_deprecated
def test_create_alarm():
conn = boto.connect_cloudwatch()
@ -42,7 +44,8 @@ def test_create_alarm():
alarm.evaluation_periods.should.equal(5)
alarm.statistic.should.equal('Average')
alarm.description.should.equal('A test')
dict(alarm.dimensions).should.equal({'InstanceId': ['i-0123456,i-0123457']})
dict(alarm.dimensions).should.equal(
{'InstanceId': ['i-0123456,i-0123457']})
list(alarm.alarm_actions).should.equal(['arn:alarm'])
list(alarm.ok_actions).should.equal(['arn:ok'])
list(alarm.insufficient_data_actions).should.equal(['arn:insufficient'])
@ -84,7 +87,8 @@ def test_put_metric_data():
metric = metrics[0]
metric.namespace.should.equal('tester')
metric.name.should.equal('metric')
dict(metric.dimensions).should.equal({'InstanceId': ['i-0123456,i-0123457']})
dict(metric.dimensions).should.equal(
{'InstanceId': ['i-0123456,i-0123457']})
@mock_cloudwatch_deprecated
@ -103,7 +107,8 @@ def test_describe_alarms():
alarms.should.have.length_of(4)
alarms = conn.describe_alarms(alarm_name_prefix="nfoo")
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 = conn.describe_alarms(action_prefix="afoo")
alarms.should.have.length_of(2)
@ -114,10 +119,11 @@ def test_describe_alarms():
alarms = conn.describe_alarms()
alarms.should.have.length_of(0)
@mock_cloudwatch_deprecated
def test_describe_state_value_unimplemented():
conn = boto.connect_cloudwatch()
conn.describe_alarms()
conn.describe_alarms.when.called_with(state_value="foo").should.throw(NotImplementedError)
conn.describe_alarms.when.called_with(
state_value="foo").should.throw(NotImplementedError)