示例#1
0
def test_new_no_branch_on_remote(tmpdir, git2jss_test_repo):
    """ Remote doesn't have our tag """
    _build_local_repo(str(tmpdir),
                      remote=git2jss_test_repo)
    with raises(vcs.RefNotFoundError):
        vcs.GitRepo(branch='NotBranch',
                    sourcedir=str(tmpdir))
示例#2
0
def test_too_many_remotes(tmpdir):
    """ Directory has too many remotes configured """
    _build_local_repo(str(tmpdir), remote=TEST_REPO)
    # Add another remote
    subprocess.call(
        ["git", "remote", "add", "notherone", "https://notarepo.example.com"],
        cwd=str(tmpdir))

    with raises(vcs.TooManyRemotesError):
        vcs.GitRepo(tag='NotATag', sourcedir=str(tmpdir))
示例#3
0
def test_new_no_tag_on_remote(tmpdir):
    """ Remote doesn't have our tag """
    _build_local_repo(str(tmpdir), remote=TEST_REPO)
    with raises(vcs.TagNotFoundError):
        vcs.GitRepo(tag='NotATag', sourcedir=str(tmpdir))
示例#4
0
def test_new_no_remote(tmpdir):
    """ Directory has no git remotes configured """
    _build_local_repo(str(tmpdir))
    with raises(vcs.NoRemoteError):
        vcs.GitRepo(tag='NotATag', sourcedir=str(tmpdir))
示例#5
0
def test_new_gitrepo_not_a_repo(tmpdir):
    """ Directory is not a git repo """
    with raises(vcs.NotAGitRepoError):
        vcs.GitRepo(tag='NotATag', sourcedir=str(tmpdir))
示例#6
0
def fixture_gitrepo(tmpdir_factory):
    """ Return a valid GitRepo object """
    tmp_dir = str(tmpdir_factory.mktemp('gitrepo'))
    _build_local_repo(tmp_dir, remote=TEST_REPO)
    return vcs.GitRepo(tag='test-1.0.0', sourcedir=tmp_dir)
示例#7
0
def fixture_a_gitrepo(jss_repo):
    repo = vcs.GitRepo(tag='git2jss-test', sourcedir=jss_repo)
    return repo
示例#8
0
# --*-- encoding: utf-8 --*--
import git2jss.processors as processors
import git2jss.vcs as vcs
import git2jss.jss_keyring as jkc
import pytest
from pytest import raises
import jss

# You'll need to create this file...
prefs = jkc.KJSSPrefs(preferences_file='tests/com.github.gkluoe.git2jss.plist')

JSS = jss.JSS(prefs)
repo = vcs.GitRepo(tag='0.0.49', sourcedir='_JSS')


def test_new_generic_object():
    """ Can we create a new Script object? """
    newobj = processors.JSSObject(repo,
                                  JSS,
                                  'coreconfig-softwareupdate-run.py',
                                  target='macad-2018-test.py')
    assert newobj


def test_new_script_object():
    """ Can we create a new Script object? """
    newobj = processors.Script(repo,
                               JSS,
                               source_file='coreconfig-softwareupdate-run.py',
                               target='macad-2018-test.py')
    assert newobj
示例#9
0
def fixture_gitrepo_master(tmpdir_factory, git2jss_test_repo):
    """ Return a valid GitRepo object """
    tmp_dir = str(tmpdir_factory.mktemp('gitrepo'))
    _build_local_repo(tmp_dir, remote=git2jss_test_repo)
    return vcs.GitRepo(branch='master',
                       sourcedir=tmp_dir)
示例#10
0
def fixture_a_gitrepo(jss_repo):
    repo = vcs.GitRepo(tag='0.0.49', sourcedir=jss_repo)
    return repo