summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-13 16:31:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-13 16:31:11 +0000
commitcc643ce932b2abdc56c4d1933c02806ca57ddefa (patch)
treeeeaaba02f0eee8ce2d06a10609ccffebdfb1ee4d /test
parent6ef6459630cfd8fd5af31d527c0043243ef2cb09 (diff)
downloadredmine-cc643ce932b2abdc56c4d1933c02806ca57ddefa.tar.gz
redmine-cc643ce932b2abdc56c4d1933c02806ca57ddefa.zip
Merged nbc branch @ r1812 (commit access permission and reposman improvements).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1814 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/sys_api_test.rb31
-rw-r--r--test/unit/role_test.rb20
2 files changed, 45 insertions, 6 deletions
diff --git a/test/functional/sys_api_test.rb b/test/functional/sys_api_test.rb
index ec8d0964e..48ed780d0 100644
--- a/test/functional/sys_api_test.rb
+++ b/test/functional/sys_api_test.rb
@@ -5,7 +5,7 @@ require 'sys_controller'
class SysController; def rescue_action(e) raise e end; end
class SysControllerTest < Test::Unit::TestCase
- fixtures :projects, :repositories
+ fixtures :projects, :enabled_modules, :repositories
def setup
@controller = SysController.new
@@ -15,17 +15,36 @@ class SysControllerTest < Test::Unit::TestCase
Setting.sys_api_enabled = 1
end
- def test_projects
- result = invoke :projects
- assert_equal Project.count, result.size
- assert result.first.is_a?(Project)
+ def test_projects_with_repository_enabled
+ result = invoke :projects_with_repository_enabled
+ assert_equal EnabledModule.count(:all, :conditions => {:name => 'repository'}), result.size
+
+ project = result.first
+ assert project.is_a?(AWSProjectWithRepository)
+
+ assert project.respond_to?(:id)
+ assert_equal 1, project.id
+
+ assert project.respond_to?(:identifier)
+ assert_equal 'ecookbook', project.identifier
+
+ assert project.respond_to?(:name)
+ assert_equal 'eCookbook', project.name
+
+ assert project.respond_to?(:is_public)
+ assert project.is_public
+
+ assert project.respond_to?(:repository)
+ assert project.repository.is_a?(Repository)
end
def test_repository_created
project = Project.find(3)
assert_nil project.repository
- assert invoke(:repository_created, project.identifier, 'http://localhost/svn')
+ assert invoke(:repository_created, project.identifier, 'Subversion', 'http://localhost/svn')
project.reload
assert_not_nil project.repository
+ assert project.repository.is_a?(Repository::Subversion)
+ assert_equal 'http://localhost/svn', project.repository.url
end
end
diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb
index b98af2e36..cab668c50 100644
--- a/test/unit/role_test.rb
+++ b/test/unit/role_test.rb
@@ -30,4 +30,24 @@ class RoleTest < Test::Unit::TestCase
target.reload
assert_equal 90, target.workflows.size
end
+
+ def test_add_permission
+ role = Role.find(1)
+ size = role.permissions.size
+ role.add_permission!("apermission", "anotherpermission")
+ role.reload
+ assert role.permissions.include?(:anotherpermission)
+ assert_equal size + 2, role.permissions.size
+ end
+
+ def test_remove_permission
+ role = Role.find(1)
+ size = role.permissions.size
+ perm = role.permissions[0..1]
+ role.remove_permission!(*perm)
+ role.reload
+ assert ! role.permissions.include?(perm[0])
+ assert_equal size - 2, role.permissions.size
+ end
+
end