Exemplo n.º 1
0
def test_fetch_creates_refs(filesystem):
    client_1 = filesystem / 'client_1'
    client_2 = filesystem / 'client_2'

    util.make_file(client_1 / 'foo.txt')
    _git.add(client_1, 'foo.txt')
    _git.commit(client_1, 'Committing...')
    _git.push(client_1, 'origin', 'master')

    _git.fetch(client_2, 'origin')
    assert _git.has_ref(client_2, 'refs/remotes/origin/master')
    assert not (client_2 / 'foo.txt').exists()
Exemplo n.º 2
0
def test_add_commit_push_then_pull(filesystem):
    filenames = ['test.txt', 'other.txt', 'nope.json']
    for filename in filenames:
        util.make_file(filesystem / 'client_1' / filename)

    client_1 = filesystem / 'client_1'
    client_2 = filesystem / 'client_2'

    _git.add(client_1, '*.txt')
    _git.commit(client_1, 'pushing...')
    _git.push(client_1, 'origin', 'master')
    _git.pull(client_2, 'origin', 'master')

    for filename in filenames:
        assert (client_2 / filename).exists() == filename.endswith('.txt')
Exemplo n.º 3
0
def test_ref_exists(filesystem):
    client_1 = filesystem / 'client_1'
    assert not _git.has_ref(client_1, 'refs/heads/master')
    assert not _git.has_ref(client_1, 'refs/remotes/origin/master')

    util.make_file(client_1 / 'foo.txt')
    _git.add(client_1, 'foo.txt')
    assert not _git.has_ref(client_1, 'refs/heads/master')

    _git.commit(client_1, 'Committing...')
    assert _git.has_ref(client_1, 'refs/heads/master')

    _git.push(client_1, 'origin', 'master')
    assert _git.has_ref(client_1, 'refs/remotes/origin/master')

    _git.fetch(client_1, 'origin')
    assert _git.has_ref(client_1, 'refs/remotes/origin/master')