##// END OF EJS Templates
scm: bazaar: change project id of unit app test from 1 to 3....
Toshi MARUYAMA -
r4857:089c23f2288c
parent child
Show More
@@ -1,75 +1,75
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RepositoryBazaarTest < ActiveSupport::TestCase
21 21 fixtures :projects
22 22
23 23 # No '..' in the repository path
24 24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository'
25 25 REPOSITORY_PATH.gsub!(/\/+/, '/')
26 26
27 27 def setup
28 @project = Project.find(1)
28 @project = Project.find(3)
29 29 assert @repository = Repository::Bazaar.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}")
30 30 end
31 31
32 32 if File.directory?(REPOSITORY_PATH)
33 33 def test_fetch_changesets_from_scratch
34 34 @repository.fetch_changesets
35 35 @repository.reload
36 36
37 37 assert_equal 4, @repository.changesets.count
38 38 assert_equal 9, @repository.changes.count
39 39 assert_equal 'Initial import', @repository.changesets.find_by_revision('1').comments
40 40 end
41 41
42 42 def test_fetch_changesets_incremental
43 43 @repository.fetch_changesets
44 44 # Remove changesets with revision > 5
45 45 @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 2}
46 46 @repository.reload
47 47 assert_equal 2, @repository.changesets.count
48 48
49 49 @repository.fetch_changesets
50 50 assert_equal 4, @repository.changesets.count
51 51 end
52 52
53 53 def test_entries
54 54 entries = @repository.entries
55 55 assert_equal 2, entries.size
56 56
57 57 assert_equal 'dir', entries[0].kind
58 58 assert_equal 'directory', entries[0].name
59 59
60 60 assert_equal 'file', entries[1].kind
61 61 assert_equal 'doc-mkdir.txt', entries[1].name
62 62 end
63 63
64 64 def test_entries_in_subdirectory
65 65 entries = @repository.entries('directory')
66 66 assert_equal 3, entries.size
67 67
68 68 assert_equal 'file', entries.last.kind
69 69 assert_equal 'edit.png', entries.last.name
70 70 end
71 71 else
72 72 puts "Bazaar test repository NOT FOUND. Skipping unit tests !!!"
73 73 def test_fake; assert true end
74 74 end
75 75 end
General Comments 0
You need to be logged in to leave comments. Login now