##// END OF EJS Templates
scm: bazaar: use constant for project id in functional test....
Toshi MARUYAMA -
r5762:29b2db0891c9
parent child
Show More
@@ -26,13 +26,14 class RepositoriesBazaarControllerTest < ActionController::TestCase
26
26
27 # No '..' in the repository path
27 # No '..' in the repository path
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository'
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository'
29 PRJ_ID = 3
29
30
30 def setup
31 def setup
31 @controller = RepositoriesController.new
32 @controller = RepositoriesController.new
32 @request = ActionController::TestRequest.new
33 @request = ActionController::TestRequest.new
33 @response = ActionController::TestResponse.new
34 @response = ActionController::TestResponse.new
34 User.current = nil
35 User.current = nil
35 @project = Project.find(3)
36 @project = Project.find(PRJ_ID)
36 @repository = Repository::Bazaar.create(
37 @repository = Repository::Bazaar.create(
37 :project => @project, :url => REPOSITORY_PATH,
38 :project => @project, :url => REPOSITORY_PATH,
38 :log_encoding => 'UTF-8')
39 :log_encoding => 'UTF-8')
@@ -41,7 +42,7 class RepositoriesBazaarControllerTest < ActionController::TestCase
41
42
42 if File.directory?(REPOSITORY_PATH)
43 if File.directory?(REPOSITORY_PATH)
43 def test_show
44 def test_show
44 get :show, :id => 3
45 get :show, :id => PRJ_ID
45 assert_response :success
46 assert_response :success
46 assert_template 'show'
47 assert_template 'show'
47 assert_not_nil assigns(:entries)
48 assert_not_nil assigns(:entries)
@@ -49,7 +50,7 class RepositoriesBazaarControllerTest < ActionController::TestCase
49 end
50 end
50
51
51 def test_browse_root
52 def test_browse_root
52 get :show, :id => 3
53 get :show, :id => PRJ_ID
53 assert_response :success
54 assert_response :success
54 assert_template 'show'
55 assert_template 'show'
55 assert_not_nil assigns(:entries)
56 assert_not_nil assigns(:entries)
@@ -59,7 +60,7 class RepositoriesBazaarControllerTest < ActionController::TestCase
59 end
60 end
60
61
61 def test_browse_directory
62 def test_browse_directory
62 get :show, :id => 3, :path => ['directory']
63 get :show, :id => PRJ_ID, :path => ['directory']
63 assert_response :success
64 assert_response :success
64 assert_template 'show'
65 assert_template 'show'
65 assert_not_nil assigns(:entries)
66 assert_not_nil assigns(:entries)
@@ -71,7 +72,7 class RepositoriesBazaarControllerTest < ActionController::TestCase
71 end
72 end
72
73
73 def test_browse_at_given_revision
74 def test_browse_at_given_revision
74 get :show, :id => 3, :path => [], :rev => 3
75 get :show, :id => PRJ_ID, :path => [], :rev => 3
75 assert_response :success
76 assert_response :success
76 assert_template 'show'
77 assert_template 'show'
77 assert_not_nil assigns(:entries)
78 assert_not_nil assigns(:entries)
@@ -79,14 +80,14 class RepositoriesBazaarControllerTest < ActionController::TestCase
79 end
80 end
80
81
81 def test_changes
82 def test_changes
82 get :changes, :id => 3, :path => ['doc-mkdir.txt']
83 get :changes, :id => PRJ_ID, :path => ['doc-mkdir.txt']
83 assert_response :success
84 assert_response :success
84 assert_template 'changes'
85 assert_template 'changes'
85 assert_tag :tag => 'h2', :content => 'doc-mkdir.txt'
86 assert_tag :tag => 'h2', :content => 'doc-mkdir.txt'
86 end
87 end
87
88
88 def test_entry_show
89 def test_entry_show
89 get :entry, :id => 3, :path => ['directory', 'doc-ls.txt']
90 get :entry, :id => PRJ_ID, :path => ['directory', 'doc-ls.txt']
90 assert_response :success
91 assert_response :success
91 assert_template 'entry'
92 assert_template 'entry'
92 # Line 19
93 # Line 19
@@ -97,14 +98,14 class RepositoriesBazaarControllerTest < ActionController::TestCase
97 end
98 end
98
99
99 def test_entry_download
100 def test_entry_download
100 get :entry, :id => 3, :path => ['directory', 'doc-ls.txt'], :format => 'raw'
101 get :entry, :id => PRJ_ID, :path => ['directory', 'doc-ls.txt'], :format => 'raw'
101 assert_response :success
102 assert_response :success
102 # File content
103 # File content
103 assert @response.body.include?('Show help message')
104 assert @response.body.include?('Show help message')
104 end
105 end
105
106
106 def test_directory_entry
107 def test_directory_entry
107 get :entry, :id => 3, :path => ['directory']
108 get :entry, :id => PRJ_ID, :path => ['directory']
108 assert_response :success
109 assert_response :success
109 assert_template 'show'
110 assert_template 'show'
110 assert_not_nil assigns(:entry)
111 assert_not_nil assigns(:entry)
@@ -113,7 +114,7 class RepositoriesBazaarControllerTest < ActionController::TestCase
113
114
114 def test_diff
115 def test_diff
115 # Full diff of changeset 3
116 # Full diff of changeset 3
116 get :diff, :id => 3, :rev => 3
117 get :diff, :id => PRJ_ID, :rev => 3
117 assert_response :success
118 assert_response :success
118 assert_template 'diff'
119 assert_template 'diff'
119 # Line 11 removed
120 # Line 11 removed
@@ -125,7 +126,7 class RepositoriesBazaarControllerTest < ActionController::TestCase
125 end
126 end
126
127
127 def test_annotate
128 def test_annotate
128 get :annotate, :id => 3, :path => ['doc-mkdir.txt']
129 get :annotate, :id => PRJ_ID, :path => ['doc-mkdir.txt']
129 assert_response :success
130 assert_response :success
130 assert_template 'annotate'
131 assert_template 'annotate'
131 # Line 2, revision 3
132 # Line 2, revision 3
General Comments 0
You need to be logged in to leave comments. Login now