def test_delete_nonexistent_alert_policy(self, mock):
# Now we don't have any policies
response = {
'policies': []
}
mock.get(
'{}/v2/alerts_policies.json?filter[name]={}'
.format(self.client.base_url, self.first_policy['name']),
json=response,
status_code=200
)
mock.delete(
'{}/v2/alerts_policies/{}.json'
.format(self.client.base_url, self.first_policy['id'])
)
with self.assertRaisesRegexp(
newrelic_cli.exceptions.ItemNotFoundError,
'{}'.format(self.first_policy['name'])
):
self.client.delete_alert_policy(self.first_policy['name'])
评论列表
文章目录