def test_notify_sends_email(limit, notification,
                            tenant, keystone, nova, send_email):
    update_expiry.notify(keystone, nova, tenant, limit)
    if notification is None:
        assert not send_email.called
    else:
        send_email.assert_called_with(tenant, notification)
def test_notify_sends_email(limit, notification,
                            tenant, keystone, nova, send_email):
    update_expiry.notify(keystone, nova, tenant, limit)
    if notification is None:
        assert not send_email.called
    else:
        send_email.assert_called_with(tenant, notification)
def test_over_limit_calls_notify_at_limit(tenant, keystone, nova,
                                          notify_at_limit):
    tenant.status = 'not pending suspension'
    update_expiry.notify(keystone, nova, tenant,
                         CPULimit.OVER_LIMIT)
    assert notify_at_limit.called
def test_over_limit_calls_notify_at_limit(tenant, keystone, nova,
                                          notify_at_limit):
    tenant.status = 'not pending suspension'
    update_expiry.notify(keystone, nova, tenant,
                         CPULimit.OVER_LIMIT)
    assert notify_at_limit.called