Пример #1
0
def test_exposure_type_not_in_str_gives_correct_json_representation():
    items = [
        ExposureType.CLOUD_STORAGE,
        ExposureType.OUTSIDE_TRUSTED_DOMAINS,
        ExposureType.SHARED_TO_DOMAIN,
    ]
    _filter = ExposureType.not_in(items)
    expected = NOT_IN.format("exposure", *items)
    assert str(_filter) == expected
Пример #2
0
def test_exposure_type_choices_returns_valid_attributes():
    choices = ExposureType.choices()
    valid_set = {
        "SharedViaLink",
        "SharedToDomain",
        "ApplicationRead",
        "CloudStorage",
        "RemovableMedia",
        "IsPublic",
        "OutsideTrustedDomains",
    }
    assert set(choices) == valid_set
Пример #3
0
def test_exposure_type_not_eq_str_gives_correct_json_representation():
    _filter = ExposureType.not_eq(ExposureType.IS_PUBLIC)
    expected = IS_NOT.format("exposure", "IsPublic")
    assert str(_filter) == expected
Пример #4
0
def test_exposure_type_eq_str_gives_correct_json_representation():
    _filter = ExposureType.eq(ExposureType.APPLICATION_READ)
    expected = IS.format("exposure", "ApplicationRead")
    assert str(_filter) == expected
Пример #5
0
def test_exposure_type_not_exists_str_gives_correct_json_representation():
    _filter = ExposureType.not_exists()
    expected = NOT_EXISTS.format("exposure")
    assert str(_filter) == expected
Пример #6
0
SEARCH_DEFAULT_HEADER["fileOwner"] = "FileOwner"
SEARCH_DEFAULT_HEADER["md5Checksum"] = "MD5Checksum"
SEARCH_DEFAULT_HEADER["sha256Checksum"] = "SHA256Checksum"

file_events_format_option = click.option(
    "-f",
    "--format",
    type=click.Choice(enum.FileEventsOutputFormat(), case_sensitive=False),
    help="The output format of the result. Defaults to table format.",
    default=enum.FileEventsOutputFormat.TABLE,
)
exposure_type_option = click.option(
    "-t",
    "--type",
    multiple=True,
    type=click.Choice(list(ExposureType.choices())),
    cls=searchopt.AdvancedQueryAndSavedSearchIncompatible,
    callback=searchopt.is_in_filter(f.ExposureType),
    help="Limits events to those with given exposure types.",
)
username_option = click.option(
    "--c42-username",
    multiple=True,
    callback=searchopt.is_in_filter(f.DeviceUsername),
    cls=searchopt.AdvancedQueryAndSavedSearchIncompatible,
    help="Limits events to endpoint events for these Code42 users.",
)
actor_option = click.option(
    "--actor",
    multiple=True,
    callback=searchopt.is_in_filter(f.Actor),
Пример #7
0
def test_exposure_type_not_in_str_gives_correct_json_representation():
    items = ["exposure1", "exposure2", "exposure3"]
    _filter = ExposureType.not_in(items)
    expected = NOT_IN.format("exposure", *items)
    assert str(_filter) == expected
Пример #8
0
def test_exposure_type_eq_str_gives_correct_json_representation():
    _filter = ExposureType.eq("test_exposure")
    expected = IS.format("exposure", "test_exposure")
    assert str(_filter) == expected