Example #1
0
def test_self_signed_secure_ssl(mocker):
    # test that we fail on a certificate error when insecure is False
    mocker.patch.object(demisto, 'params', return_value={
        'server': 'https://self-signed.badssl.com/',
        'insecure': False
    })
    mocker.patch.object(demisto, 'command', return_value='test-module')
    try:
        main()
    except Exception as ex:
        assert 'certificate' in str(ex).lower()
Example #2
0
def test_self_signed_insecure_ssl(mocker):
    # test that we fail on an error other than certificate when insecure is True
    mocker.patch.object(demisto, 'params', return_value={
        'server': 'https://self-signed.badssl.com/',
        'insecure': True
    })
    mocker.patch.object(demisto, 'command', return_value='test-module')
    try:
        main()
    except Exception as ex:
        assert 'certificate' not in str(ex).lower(), f'got certificate error: {ex}'