Exemple #1
0
def test_check_config():
    """
    Should not raise Exception
    """
    conf = {
        'clientId':'cid',
        'clientSecret':'secret',
        'everbridgeUsername':'******',
        'everbridgePassword':'******',
        'everbridgeOrg':'12345',
        'adTenant':'98765',
        'adGroupId':['group1', 'group2'],
        'logFileName':'test.log',
        'logLevel':'DEBUG'
    }
    try:
        SyncRunner.check_config(conf)
    # pylint: disable=broad-except
    except Exception:
        pytest.fail('SyncRunner.check_config raised an Exception')
Exemple #2
0
def test_check_config_with_errors():
    """
    Should raise Exception when required param is missing
    """
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientSecret':'secret',
            'everbridgeUsername':'******',
            'everbridgePassword':'******',
            'everbridgeOrg':'12345',
            'adTenant':'98765',
            'adGroupId':['group1', 'group2']
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'everbridgeUsername':'******',
            'everbridgePassword':'******',
            'everbridgeOrg':'12345',
            'adTenant':'98765',
            'adGroupId':['group1', 'group2']
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'clientSecret':'secret',
            'everbridgePassword':'******',
            'everbridgeOrg':'12345',
            'adTenant':'98765',
            'adGroupId':['group1', 'group2']
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'clientSecret':'secret',
            'everbridgeUsername':'******',
            'everbridgeOrg':'12345',
            'adTenant':'98765',
            'adGroupId':['group1', 'group2']
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'clientSecret':'secret',
            'everbridgeUsername':'******',
            'everbridgePassword':'******',
            'adTenant':'98765',
            'adGroupId':['group1', 'group2']
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'clientSecret':'secret',
            'everbridgeUsername':'******',
            'everbridgePassword':'******',
            'everbridgeOrg':'12345',
            'adGroupId':['group1', 'group2']
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'clientSecret':'secret',
            'everbridgeUsername':'******',
            'everbridgePassword':'******',
            'everbridgeOrg':'12345',
            'adTenant':'98765'
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'clientSecret':'secret',
            'everbridgeUsername':'******',
            'everbridgePassword':'******',
            'everbridgeOrg':'12345',
            'adTenant':'98765',
            'adGroupId':'group1'
        })
    with pytest.raises(SyncRunnerException):
        SyncRunner.check_config({
            'clientId':'cid',
            'clientSecret':'secret',
            'everbridgeUsername':'******',
            'everbridgePassword':'******',
            'everbridgeOrg':'12345',
            'adTenant':'98765',
            'adGroupId':['group1', 'group2'],
            'logLevel':'XXXXX'
        })