def test_inspect_string_no_results(capsys):
    test_string = 'Nothing to see here'

    inspect_content.inspect_string(test_string, include_quote=True)

    out, _ = capsys.readouterr()
    assert 'No findings' in out
def test_inspect_string(capsys):
    test_string = 'I am Gary and my email is [email protected]'

    inspect_content.inspect_string(test_string, include_quote=True)

    out, _ = capsys.readouterr()
    assert 'Info type: EMAIL_ADDRESS' in out
Пример #3
0
def test_inspect_string_no_results(capsys):
    test_string = "Nothing to see here"

    inspect_content.inspect_string(
        GCLOUD_PROJECT, test_string, ["FIRST_NAME", "EMAIL_ADDRESS"], include_quote=True
    )

    out, _ = capsys.readouterr()
    assert "No findings" in out
def test_inspect_string_no_results(capsys):
    test_string = 'Nothing to see here'

    inspect_content.inspect_string(GCLOUD_PROJECT,
                                   test_string,
                                   ['FIRST_NAME', 'EMAIL_ADDRESS'],
                                   include_quote=True)

    out, _ = capsys.readouterr()
    assert 'No findings' in out
Пример #5
0
def test_inspect_string(capsys):
    test_string = "My name is Gary Smith and my email is [email protected]"

    inspect_content.inspect_string(
        GCLOUD_PROJECT, test_string, ["FIRST_NAME", "EMAIL_ADDRESS"], include_quote=True
    )

    out, _ = capsys.readouterr()
    assert "Info type: FIRST_NAME" in out
    assert "Info type: EMAIL_ADDRESS" in out
def test_inspect_string_with_info_types(capsys):
    test_string = 'I am Gary and my email is [email protected]'

    inspect_content.inspect_string(test_string,
                                   info_types=['US_MALE_NAME'],
                                   include_quote=True)

    out, _ = capsys.readouterr()
    assert 'Info type: US_MALE_NAME' in out
    assert 'Info type: EMAIL_ADDRESS' not in out
def test_inspect_string_no_results(capsys):
    test_string = 'Nothing to see here'

    inspect_content.inspect_string(
        GCLOUD_PROJECT,
        test_string,
        ['FIRST_NAME', 'EMAIL_ADDRESS'],
        include_quote=True)

    out, _ = capsys.readouterr()
    assert 'No findings' in out
def test_inspect_string(capsys):
    test_string = 'My name is Gary Smith and my email is [email protected]'

    inspect_content.inspect_string(
        GCLOUD_PROJECT,
        test_string,
        ['FIRST_NAME', 'EMAIL_ADDRESS'],
        include_quote=True)

    out, _ = capsys.readouterr()
    assert 'Info type: FIRST_NAME' in out
    assert 'Info type: EMAIL_ADDRESS' in out
def test_inspect_string_with_custom_info_types(capsys):
    test_string = 'My name is Gary Smith and my email is [email protected]'
    dictionaries = ['Gary Smith']
    regexes = ['\\w+@\\w+.com']

    inspect_content.inspect_string(GCLOUD_PROJECT,
                                   test_string, [],
                                   custom_dictionaries=dictionaries,
                                   custom_regexes=regexes,
                                   include_quote=True)

    out, _ = capsys.readouterr()
    assert 'Info type: CUSTOM_DICTIONARY_0' in out
    assert 'Info type: CUSTOM_REGEX_0' in out
def test_inspect_string_with_custom_info_types(capsys):
    test_string = 'My name is Gary Smith and my email is [email protected]'
    dictionaries = ['Gary Smith']
    regexes = ['\\w+@\\w+.com']

    inspect_content.inspect_string(
        GCLOUD_PROJECT,
        test_string,
        [],
        custom_dictionaries=dictionaries,
        custom_regexes=regexes,
        include_quote=True)

    out, _ = capsys.readouterr()
    assert 'Info type: CUSTOM_DICTIONARY_0' in out
    assert 'Info type: CUSTOM_REGEX_0' in out