def test_process_jenkins_yml_settings_reviewers_compat():
    from jenkins_epo.repository import Repository

    repo = Repository('owner', 'repo1')
    repo.process_settings(jenkins_yml=repr(
        dict(settings=dict(reviewers=['bdfl']))), )
    assert ['bdfl'] == repo.SETTINGS.COLLABORATORS
def test_process_jenkins_yml_settings():
    from jenkins_epo.repository import Repository

    repo = Repository('owner', 'repo1')
    repo.process_settings(jenkins_yml=repr(
        dict(settings=dict(collaborators=['bdfl', 'hacker']))), )
    assert ['bdfl', 'hacker'] == repo.SETTINGS.COLLABORATORS
def test_collaborators():
    from jenkins_epo.repository import Repository

    repo = Repository('owner', 'repository')
    repo.process_settings(collaborators=[
        {
            'login': '******',
            'site_admin': True
        },
        {
            'login': '******',
            'permissions': {
                'admin': False,
                'pull': False,
                'push': False
            },
            'site_admin': False,
        },
        {
            'login': '******',
            'permissions': {
                'admin': False,
                'pull': True,
                'push': True
            },
            'site_admin': False,
        },
        {
            'login': '******',
            'permissions': {
                'admin': True,
                'pull': True,
                'push': True
            },
            'site_admin': False,
        },
    ])

    collaborators = repo.SETTINGS.COLLABORATORS

    assert 'siteadmin' in collaborators
    assert 'contributor' not in collaborators
    assert 'pusher' in collaborators
    assert 'owner' in collaborators