Maps repository users to Redmine users (#1383).
Users with same username or email are automatically mapped. Mapping can be manually adjusted in repository settings. Multiple usernames can be mapped to the same Redmine user. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2006 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -40,6 +40,7 @@ class RepositoryGitTest < Test::Unit::TestCase
|
||||
commit = @repository.changesets.find(:first, :order => 'committed_on ASC')
|
||||
assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
|
||||
assert_equal "jsmith <jsmith@foo.bar>", commit.committer
|
||||
assert_equal User.find_by_login('jsmith'), commit.user
|
||||
# TODO: add a commit with commit time <> author time to the test repository
|
||||
assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on
|
||||
assert_equal "2007-12-14".to_date, commit.commit_date
|
||||
|
||||
@@ -127,4 +127,26 @@ class RepositoryTest < Test::Unit::TestCase
|
||||
assert_equal ':pserver:login:password@host:/path/to/the/repository', repository.url
|
||||
assert_equal 'foo', repository.root_url
|
||||
end
|
||||
|
||||
def test_manual_user_mapping
|
||||
assert_no_difference "Changeset.count(:conditions => 'user_id <> 2')" do
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
|
||||
assert_nil c.user
|
||||
@repository.committer_ids = {'foo' => '2'}
|
||||
assert_equal User.find(2), c.reload.user
|
||||
# committer is now mapped
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'foo', :committed_on => Time.now, :revision => 101, :comments => 'Another commit by foo.')
|
||||
assert_equal User.find(2), c.user
|
||||
end
|
||||
end
|
||||
|
||||
def test_auto_user_mapping_by_username
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'jsmith', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.')
|
||||
assert_equal User.find(2), c.user
|
||||
end
|
||||
|
||||
def test_auto_user_mapping_by_email
|
||||
c = Changeset.create!(:repository => @repository, :committer => 'john <jsmith@somenet.foo>', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.')
|
||||
assert_equal User.find(2), c.user
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user