#557 unit tests
This commit is contained in:
parent
dd32608008
commit
7b5847651c
@ -172,6 +172,19 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_dmsf_file_watch
|
||||||
|
get :dmsf, params: { id: @file1.project, ids: ["file-#{@file1.id}"] }
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a.icon-fav-off', text: l(:button_watch)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_dmsf_file_unwatch
|
||||||
|
@file1.add_watcher @jsmith
|
||||||
|
get :dmsf, params: { id: @file1.project, ids: ["file-#{@file1.id}"] }
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a.icon-fav', text: l(:button_unwatch)
|
||||||
|
end
|
||||||
|
|
||||||
def test_dmsf_file_link
|
def test_dmsf_file_link
|
||||||
with_settings :notified_events => ['dmsf_legacy_notifications'] do
|
with_settings :notified_events => ['dmsf_legacy_notifications'] do
|
||||||
get :dmsf, params: {
|
get :dmsf, params: {
|
||||||
@ -297,6 +310,19 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
|||||||
assert_select 'a:not(icon-email.disabled)', text: l(:field_mail)
|
assert_select 'a:not(icon-email.disabled)', text: l(:field_mail)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_dmsf_folder_watch
|
||||||
|
get :dmsf, params: { id: @folder1.project, ids: ["folder-#{@folder1.id}"] }
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a.icon-fav-off', text: l(:button_watch)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_dmsf_folder_unwatch
|
||||||
|
@folder1.add_watcher @jsmith
|
||||||
|
get :dmsf, params: { id: @folder1.project, ids: ["folder-#{@folder1.id}"] }
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a.icon-fav', text: l(:button_unwatch)
|
||||||
|
end
|
||||||
|
|
||||||
def test_dmsf_folder_link
|
def test_dmsf_folder_link
|
||||||
with_settings :notified_events => ['dmsf_legacy_notifications'] do
|
with_settings :notified_events => ['dmsf_legacy_notifications'] do
|
||||||
get :dmsf, params: { id: @folder_link1.project.id, ids: ["folder-#{@folder_link1.id}"] }
|
get :dmsf, params: { id: @folder_link1.project.id, ids: ["folder-#{@folder_link1.id}"] }
|
||||||
@ -336,6 +362,19 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
|||||||
assert_select 'a.icon-email', text: l(:field_mail)
|
assert_select 'a.icon-email', text: l(:field_mail)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_dmsf_project_watch
|
||||||
|
get :dmsf, params: { ids: ["project-#{@project1.id}"] }
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a.icon-fav-off', text: l(:button_watch)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_dmsf_project_unwatch
|
||||||
|
@project1.add_watcher @jsmith
|
||||||
|
get :dmsf, params: { ids: ["project-#{@project1.id}"] }
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'a.icon-fav', text: l(:button_unwatch)
|
||||||
|
end
|
||||||
|
|
||||||
def test_trash_file
|
def test_trash_file
|
||||||
get :trash, params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
get :trash, params: { id: @file1.project.id, ids: ["file-#{@file1.id}"] }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class MyControllerTest < RedmineDmsf::Test::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_page_with_open_locked_documents
|
def test_page_with_open_locked_documents
|
||||||
@request.session[:user_id] = @admin.id
|
@request.session[:user_id] = @admin.id
|
||||||
@admin.pref[:my_page_layout] = { 'top' => ['locked_documents'] }
|
@admin.pref[:my_page_layout] = { 'top' => ['locked_documents'] }
|
||||||
@ -71,4 +71,17 @@ class MyControllerTest < RedmineDmsf::Test::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_page_with_open_watched_documents
|
||||||
|
@jsmith.pref[:my_page_layout] = { 'top' => ['watched_documents'] }
|
||||||
|
@jsmith.pref.save!
|
||||||
|
@file1.add_watcher @jsmith
|
||||||
|
@folder1.add_watcher @jsmith
|
||||||
|
@project1.add_watcher @jsmith
|
||||||
|
get :page
|
||||||
|
assert_response :success
|
||||||
|
assert_select 'div#list-top' do
|
||||||
|
assert_select 'h3', { text: "#{l(:label_dmsf_watched)} (2/1)" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -275,4 +275,9 @@ class DmsfFileTest < RedmineDmsf::Test::UnitTest
|
|||||||
assert_equal '', @file1.locked_by
|
assert_equal '', @file1.locked_by
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_watchable
|
||||||
|
@file1.add_watcher @jsmith
|
||||||
|
assert @file1.watched_by?(@jsmith)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -258,4 +258,9 @@ class DmsfFolderTest < RedmineDmsf::Test::UnitTest
|
|||||||
assert @folder6.empty?
|
assert @folder6.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_watchable
|
||||||
|
@folder1.add_watcher @jsmith
|
||||||
|
assert @folder1.watched_by?(@jsmith)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -116,4 +116,12 @@ class DmsfMailerTest < RedmineDmsf::Test::UnitTest
|
|||||||
assert users.blank?
|
assert users.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_get_notify_users_with_watchers
|
||||||
|
@file1.add_watcher @jsmith
|
||||||
|
with_settings :notified_events => [] do
|
||||||
|
users = DmsfMailer.get_notify_users(@project1, @file1)
|
||||||
|
assert users.present?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -103,4 +103,9 @@ class ProjectPatchTest < RedmineDmsf::Test::UnitTest
|
|||||||
assert !@project3.dmsf_available?
|
assert !@project3.dmsf_available?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_watchable
|
||||||
|
@project1.add_watcher @jsmith
|
||||||
|
assert @project1.watched_by?(@jsmith)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user