Exemplo n.º 1
0
def fixture_monitoring_user(request_context):
    """Returns a "Normal monitoring user" object."""
    user_dir = cmk.utils.paths.profile_dir / "test"
    user_dir.mkdir(parents=True)
    user_dir.joinpath("cached_profile.mk").write_text(
        str(MONITORING_USER_CACHED_PROFILE))
    # SITE STATUS snapin settings:
    user_dir.joinpath("siteconfig.mk").write_text(
        str(MONITORING_USER_SITECONFIG))
    # Ordering of the buttons:
    user_dir.joinpath("buttoncounts.mk").write_text(
        str(MONITORING_USER_BUTTONCOUNTS))
    # Favorites set in the commands menu:
    user_dir.joinpath("favorites.mk").write_text(
        str(MONITORING_USER_FAVORITES))

    assert builtin_role_ids == ["user", "admin", "guest"]
    assert "test" not in active_config.admin_users

    with create_and_destroy_user(username="******") as user:
        yield LoggedInUser(user[0])
Exemplo n.º 2
0
def with_user(request_context: None,
              load_config: None) -> Iterator[tuple[UserId, str]]:
    with create_and_destroy_user(automation=False, role="user") as user:
        yield user
Exemplo n.º 3
0
def with_automation_user(request_context, load_config):
    with create_and_destroy_user(automation=True, role="admin") as user:
        yield user
Exemplo n.º 4
0
def with_user(request_context, load_config):
    with create_and_destroy_user(automation=False, role="user") as user:
        yield user