Example #1
0
def test_list_instances__oidc_env__env_config_does_not_exist__oidc_should_be_disabled(
        mocker):
    mock_instances = [{
        "name": "escape",
        "display_name": "ESCAPE",
        "mode": "replica",
        "rucio_base_url": "https://rucio-cms",
        "destination_rse": "SWAN-EOS",
        "rse_mount_path": "/eos/user/rucio",
        "path_begins_at": 4,
        "oidc_auth": "env",
    }]

    mocker.patch('rucio_jupyterlab.config.config.get_oidc_token',
                 return_value=None)

    mock_config = Struct(instances=mock_instances)
    config = Config(mock_config)

    expected_instances = [
        {
            'display_name': 'ESCAPE',
            'name': 'escape',
            'oidc_enabled': False
        },
    ]

    assert config.list_instances() == expected_instances, "Invalid instances"
Example #2
0
def test_list_instances__oidc_disabled():
    mock_instances = [{
        "name": "atlas",
        "display_name": "ATLAS",
        "mode": "replica",
        "rucio_base_url": "https://rucio",
        "destination_rse": "SWAN-EOS",
        "rse_mount_path": "/eos/user/rucio",
        "path_begins_at": 4
    }, {
        "name": "cms",
        "display_name": "CMS",
        "mode": "replica",
        "rucio_base_url": "https://rucio-cms",
        "destination_rse": "SWAN-EOS",
        "rse_mount_path": "/eos/user/rucio",
        "path_begins_at": 4
    }]

    mock_config = Struct(instances=mock_instances)
    config = Config(mock_config)

    expected_instances = [{
        'display_name': 'ATLAS',
        'name': 'atlas',
        'oidc_enabled': False
    }, {
        'display_name': 'CMS',
        'name': 'cms',
        'oidc_enabled': False
    }]

    assert config.list_instances() == expected_instances, "Invalid instances"