@@ -0,0 +1,13 | |||||
|
1 | Creating test repositories | |||
|
2 | =================== | |||
|
3 | ||||
|
4 | mkdir tmp/test | |||
|
5 | ||||
|
6 | Subversion | |||
|
7 | ---------- | |||
|
8 | svnadmin create tmp/test/subversion_repository | |||
|
9 | gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load tmp/test/subversion_repository | |||
|
10 | ||||
|
11 | Bazaar | |||
|
12 | ------ | |||
|
13 | gunzip < test/fixtures/repositories/bazaar_repository.tar.gz | tar -xv -C tmp/test No newline at end of file |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,87 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU General Public License | |||
|
15 | # along with this program; if not, write to the Free Software | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
19 | ||||
|
20 | class RepositoryBazaarTest < Test::Unit::TestCase | |||
|
21 | fixtures :projects | |||
|
22 | ||||
|
23 | # No '..' in the repository path | |||
|
24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + 'tmp/test/bazaar_repository' | |||
|
25 | ||||
|
26 | def setup | |||
|
27 | @project = Project.find(1) | |||
|
28 | assert @repository = Repository::Bazaar.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}") | |||
|
29 | end | |||
|
30 | ||||
|
31 | if File.directory?(REPOSITORY_PATH) | |||
|
32 | def test_fetch_changesets_from_scratch | |||
|
33 | @repository.fetch_changesets | |||
|
34 | @repository.reload | |||
|
35 | ||||
|
36 | assert_equal 4, @repository.changesets.count | |||
|
37 | assert_equal 9, @repository.changes.count | |||
|
38 | assert_equal 'Initial import', @repository.changesets.find_by_revision(1).comments | |||
|
39 | end | |||
|
40 | ||||
|
41 | def test_fetch_changesets_incremental | |||
|
42 | @repository.fetch_changesets | |||
|
43 | # Remove changesets with revision > 5 | |||
|
44 | @repository.changesets.find(:all, :conditions => 'revision > 2').each(&:destroy) | |||
|
45 | @repository.reload | |||
|
46 | assert_equal 2, @repository.changesets.count | |||
|
47 | ||||
|
48 | @repository.fetch_changesets | |||
|
49 | assert_equal 4, @repository.changesets.count | |||
|
50 | end | |||
|
51 | ||||
|
52 | def test_entries | |||
|
53 | entries = @repository.entries | |||
|
54 | assert_equal 2, entries.size | |||
|
55 | ||||
|
56 | assert_equal 'dir', entries[0].kind | |||
|
57 | assert_equal 'directory', entries[0].name | |||
|
58 | ||||
|
59 | assert_equal 'file', entries[1].kind | |||
|
60 | assert_equal 'doc-mkdir.txt', entries[1].name | |||
|
61 | end | |||
|
62 | ||||
|
63 | def test_entries_in_subdirectory | |||
|
64 | entries = @repository.entries('directory') | |||
|
65 | assert_equal 3, entries.size | |||
|
66 | ||||
|
67 | assert_equal 'file', entries.last.kind | |||
|
68 | assert_equal 'edit.png', entries.last.name | |||
|
69 | end | |||
|
70 | ||||
|
71 | def test_cat | |||
|
72 | cat = @repository.scm.cat('directory/document.txt') | |||
|
73 | assert cat =~ /Write the contents of a file as of a given revision to standard output/ | |||
|
74 | end | |||
|
75 | ||||
|
76 | def test_annotate | |||
|
77 | annotate = @repository.scm.annotate('doc-mkdir.txt') | |||
|
78 | assert_equal 17, annotate.lines.size | |||
|
79 | assert_equal 1, annotate.revisions[0].identifier | |||
|
80 | assert_equal 'jsmith@', annotate.revisions[0].author | |||
|
81 | assert_equal 'mkdir', annotate.lines[0] | |||
|
82 | end | |||
|
83 | else | |||
|
84 | puts "Bazaar test repository NOT FOUND. Skipping tests !!!" | |||
|
85 | def test_fake; assert true end | |||
|
86 | end | |||
|
87 | end |
@@ -1,55 +1,55 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 | class RepositorySubversionTest < Test::Unit::TestCase |
|
20 | class RepositorySubversionTest < Test::Unit::TestCase | |
21 | fixtures :projects |
|
21 | fixtures :projects | |
22 |
|
22 | |||
23 | # No '..' in the repository path for svn |
|
23 | # No '..' in the repository path for svn | |
24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository' |
|
24 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository' | |
25 |
|
25 | |||
26 | def setup |
|
26 | def setup | |
27 | @project = Project.find(1) |
|
27 | @project = Project.find(1) | |
28 | assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}") |
|
28 | assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}") | |
29 | end |
|
29 | end | |
30 |
|
30 | |||
31 | if File.directory?(REPOSITORY_PATH) |
|
31 | if File.directory?(REPOSITORY_PATH) | |
32 | def test_fetch_changesets_from_scratch |
|
32 | def test_fetch_changesets_from_scratch | |
33 | @repository.fetch_changesets |
|
33 | @repository.fetch_changesets | |
34 | @repository.reload |
|
34 | @repository.reload | |
35 |
|
35 | |||
36 | assert_equal 8, @repository.changesets.count |
|
36 | assert_equal 8, @repository.changesets.count | |
37 | assert_equal 16, @repository.changes.count |
|
37 | assert_equal 16, @repository.changes.count | |
38 | assert_equal 'Initial import.', @repository.changesets.find_by_revision(1).comments |
|
38 | assert_equal 'Initial import.', @repository.changesets.find_by_revision(1).comments | |
39 | end |
|
39 | end | |
40 |
|
40 | |||
41 | def test_fetch_changesets_incremental |
|
41 | def test_fetch_changesets_incremental | |
42 | @repository.fetch_changesets |
|
42 | @repository.fetch_changesets | |
43 | # Remove changesets with revision > 5 |
|
43 | # Remove changesets with revision > 5 | |
44 | @repository.changesets.find(:all, :conditions => 'revision > 5').each(&:destroy) |
|
44 | @repository.changesets.find(:all, :conditions => 'revision > 5').each(&:destroy) | |
45 | @repository.reload |
|
45 | @repository.reload | |
46 | assert_equal 5, @repository.changesets.count |
|
46 | assert_equal 5, @repository.changesets.count | |
47 |
|
47 | |||
48 | @repository.fetch_changesets |
|
48 | @repository.fetch_changesets | |
49 | assert_equal 8, @repository.changesets.count |
|
49 | assert_equal 8, @repository.changesets.count | |
50 | end |
|
50 | end | |
51 | else |
|
51 | else | |
52 | puts "Subversion test repository NOT FOUND. Skipping tests !!!" |
|
52 | puts "Subversion test repository NOT FOUND. Skipping tests !!!" | |
53 |
def test_fake; assert |
|
53 | def test_fake; assert true end | |
54 | end |
|
54 | end | |
55 | end |
|
55 | end |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now