1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
require 'test_helper'
class OnlineGitPushTest < Rugged::OnlineTestCase
def setup
@repo = FixtureRepo.from_libgit2("push_src")
@remote = @repo.remotes.create("test", ENV['GITTEST_REMOTE_GIT_URL'])
@target_repo = Rugged::Repository.new(ENV['GITTEST_REMOTE_REPO_PATH'])
end
if git_creds?
def test_push_branches
@remote.push([
"refs/heads/b1:refs/heads/b1",
"refs/heads/b2:refs/heads/b2",
"refs/heads/b3:refs/heads/b3",
"refs/heads/b4:refs/heads/b4",
"refs/heads/b5:refs/heads/b5"
])
assert_equal @repo.references["refs/heads/b1"].target_id, @target_repo.references["refs/heads/b1"].target_id
assert_equal @repo.references["refs/heads/b2"].target_id, @target_repo.references["refs/heads/b2"].target_id
assert_equal @repo.references["refs/heads/b3"].target_id, @target_repo.references["refs/heads/b3"].target_id
assert_equal @repo.references["refs/heads/b4"].target_id, @target_repo.references["refs/heads/b4"].target_id
assert_equal @repo.references["refs/heads/b5"].target_id, @target_repo.references["refs/heads/b5"].target_id
end
end
end
if Rugged.features.include?(:ssh)
class OnlineSshPushTest < Rugged::OnlineTestCase
def setup
@repo = FixtureRepo.from_libgit2("push_src")
@remote = @repo.remotes.create("test", ENV['GITTEST_REMOTE_SSH_URL'])
@target_repo = Rugged::Repository.new(ENV['GITTEST_REMOTE_REPO_PATH'])
end
if ssh_creds?
def test_push_branches
@remote.push([
"refs/heads/b1:refs/heads/b1",
"refs/heads/b2:refs/heads/b2",
"refs/heads/b3:refs/heads/b3",
"refs/heads/b4:refs/heads/b4",
"refs/heads/b5:refs/heads/b5"
], {
credentials: ssh_key_credential
})
assert_equal @repo.references["refs/heads/b1"].target_id, @target_repo.references["refs/heads/b1"].target_id
assert_equal @repo.references["refs/heads/b2"].target_id, @target_repo.references["refs/heads/b2"].target_id
assert_equal @repo.references["refs/heads/b3"].target_id, @target_repo.references["refs/heads/b3"].target_id
assert_equal @repo.references["refs/heads/b4"].target_id, @target_repo.references["refs/heads/b4"].target_id
assert_equal @repo.references["refs/heads/b5"].target_id, @target_repo.references["refs/heads/b5"].target_id
end
end
end
end
|