Ejemplo n.º 1
0
def cli(ctx, debug):
    """Decapod Admin commandline tool.

    With this CLI admin/operator can perform low-level maintenence of
    Decapod. This tool is not intended to be used by anyone but
    administrators. End-users should not use it at all.
    """

    ctx.obj = {"config": config.make_config()}
    utils.configure_logging(debug)
Ejemplo n.º 2
0
def cli(ctx, debug):
    """Decapod Admin commandline tool.

    With this CLI admin/operator can perform low-level maintenence of
    Decapod. This tool is not intended to be used by anyone but
    administrators. End-users should not use it at all.
    """

    ctx.obj = {
        "config": config.make_config()
    }
    utils.configure_logging(debug)
Ejemplo n.º 3
0
import functools

import pkg_resources

from decapod_common import config
from decapod_common import log
from decapod_common import playbook_plugin


NS_ALERT = "decapod.alerts"
"""Namespace for alert plugins to use."""

NS_PLAYBOOKS = "decapod.playbooks"
"""Namespace for playbook plugins to use."""

CONF = config.make_config()
"""Config."""

LOG = log.getLogger(__name__)
"""Logger."""


@functools.lru_cache(maxsize=2)
def get_alert_plugins(namespace=NS_ALERT):
    """Generator, which yield plugin entrypoints for enabled ones."""

    plugins = []

    for plugin in pkg_resources.iter_entry_points(group=namespace):
        if plugin.name in CONF["plugins"]["alerts"]["enabled"]:
            try:
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This module has tests for /v1/password_reset API."""

import unittest.mock as mock

import pytest

from decapod_common import config
from decapod_common.models import password_reset

CONF = config.make_config()


@pytest.fixture
def mock_pwreset_id(monkeypatch):
    mocked = mock.MagicMock(return_value=pytest.faux.gen_uuid())
    password_reset.PasswordReset.generate_new_id = mocked

    return mocked()


@pytest.fixture(autouse=True)
def clean_collection(configure_model, pymongo_connection):
    pymongo_connection.db.password_reset.remove({})