mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 15:26:03 +01:00
Fix tests for updated git repository (#40948).
Patch by Holger Just (@hjust). git-svn-id: https://svn.redmine.org/redmine/trunk@22929 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
require_relative '../test_helper'
|
||||
|
||||
class RepositoryGitTest < ActiveSupport::TestCase
|
||||
fixtures :projects, :repositories, :enabled_modules, :users, :roles
|
||||
fixtures :projects, :repositories, :enabled_modules, :users, :roles, :changesets
|
||||
|
||||
include Redmine::I18n
|
||||
|
||||
@@ -161,10 +161,11 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
extra_info_heads = @repository.extra_info["heads"].dup
|
||||
assert_equal NUM_HEAD, extra_info_heads.size
|
||||
extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
|
||||
extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
|
||||
assert_equal NUM_HEAD - 2, extra_info_heads.size
|
||||
del_revs =
|
||||
[
|
||||
"b1650eac7c505a6dab9f19858afc9ecb481eccc2",
|
||||
"83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
|
||||
"ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
|
||||
"4f26664364207fa8b1af9f8722647ab2d4ac5d43",
|
||||
@@ -177,7 +178,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
end
|
||||
@project.reload
|
||||
cs1 = @repository.changesets
|
||||
assert_equal NUM_REV - 6, cs1.count
|
||||
assert_equal NUM_REV - del_revs.size, cs1.count
|
||||
extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
|
||||
h = {}
|
||||
h["heads"] = extra_info_heads
|
||||
@@ -189,7 +190,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
assert_equal NUM_HEAD, @repository.extra_info["heads"].size
|
||||
assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c")
|
||||
assert @repository.extra_info["heads"].index("b1650eac7c505a6dab9f19858afc9ecb481eccc2")
|
||||
end
|
||||
|
||||
def test_fetch_changesets_history_editing
|
||||
@@ -199,10 +200,11 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
extra_info_heads = @repository.extra_info["heads"].dup
|
||||
assert_equal NUM_HEAD, extra_info_heads.size
|
||||
extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
|
||||
extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
|
||||
assert_equal NUM_HEAD - 2, extra_info_heads.size
|
||||
del_revs =
|
||||
[
|
||||
"b1650eac7c505a6dab9f19858afc9ecb481eccc2",
|
||||
"83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
|
||||
"ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
|
||||
"4f26664364207fa8b1af9f8722647ab2d4ac5d43",
|
||||
@@ -214,7 +216,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s}
|
||||
end
|
||||
@project.reload
|
||||
assert_equal NUM_REV - 6, @repository.changesets.count
|
||||
assert_equal NUM_REV - del_revs.size, @repository.changesets.count
|
||||
|
||||
c = Changeset.new(:repository => @repository,
|
||||
:committed_on => Time.now,
|
||||
@@ -223,7 +225,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
:comments => 'test')
|
||||
assert c.save
|
||||
@project.reload
|
||||
assert_equal NUM_REV - 5, @repository.changesets.count
|
||||
assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count
|
||||
|
||||
extra_info_heads << "1234abcd5678"
|
||||
h = {}
|
||||
@@ -237,7 +239,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
|
||||
@repository.fetch_changesets
|
||||
@project.reload
|
||||
assert_equal NUM_REV - 5, @repository.changesets.count
|
||||
assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count
|
||||
h2 = @repository.extra_info["heads"].dup
|
||||
assert_equal h1, h2
|
||||
end
|
||||
@@ -312,9 +314,10 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
|
||||
|
||||
extra_info_heads = @repository.extra_info["heads"].dup
|
||||
extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
|
||||
extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
|
||||
del_revs =
|
||||
[
|
||||
"b1650eac7c505a6dab9f19858afc9ecb481eccc2",
|
||||
"83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
|
||||
"ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
|
||||
"4f26664364207fa8b1af9f8722647ab2d4ac5d43",
|
||||
@@ -327,7 +330,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
||||
end
|
||||
@project.reload
|
||||
cs1 = @repository.changesets
|
||||
assert_equal NUM_REV - 6, cs1.count
|
||||
assert_equal NUM_REV - del_revs.size, cs1.count
|
||||
assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
|
||||
|
||||
extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
|
||||
|
||||
Reference in New Issue
Block a user