mirror of
https://github.com/redmine/redmine.git
synced 2026-08-07 15:09:09 +02:00
Makes spent time queries savable (#14790).
git-svn-id: http://svn.redmine.org/redmine/trunk@15639 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -399,9 +399,9 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
def test_index_with_query_id_and_project_id_should_set_session_query
|
||||
get :index, :project_id => 1, :query_id => 4
|
||||
assert_response :success
|
||||
assert_kind_of Hash, session[:query]
|
||||
assert_equal 4, session[:query][:id]
|
||||
assert_equal 1, session[:query][:project_id]
|
||||
assert_kind_of Hash, session[:issue_query]
|
||||
assert_equal 4, session[:issue_query][:id]
|
||||
assert_equal 1, session[:issue_query][:project_id]
|
||||
end
|
||||
|
||||
def test_index_with_invalid_query_id_should_respond_404
|
||||
@@ -411,7 +411,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
|
||||
def test_index_with_cross_project_query_in_session_should_show_project_issues
|
||||
q = IssueQuery.create!(:name => "test", :user_id => 2, :visibility => IssueQuery::VISIBILITY_PRIVATE, :project => nil)
|
||||
@request.session[:query] = {:id => q.id, :project_id => 1}
|
||||
@request.session[:issue_query] = {:id => q.id, :project_id => 1}
|
||||
|
||||
with_settings :display_subprojects_issues => '0' do
|
||||
get :index, :project_id => 1
|
||||
@@ -832,9 +832,9 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_equal columns, query.column_names.map(&:to_s)
|
||||
|
||||
# columns should be stored in session
|
||||
assert_kind_of Hash, session[:query]
|
||||
assert_kind_of Array, session[:query][:column_names]
|
||||
assert_equal columns, session[:query][:column_names].map(&:to_s)
|
||||
assert_kind_of Hash, session[:issue_query]
|
||||
assert_kind_of Array, session[:issue_query][:column_names]
|
||||
assert_equal columns, session[:issue_query][:column_names].map(&:to_s)
|
||||
|
||||
# ensure only these columns are kept in the selected columns list
|
||||
assert_select 'select#selected_columns option' do
|
||||
|
||||
@@ -58,6 +58,13 @@ class QueriesControllerTest < ActionController::TestCase
|
||||
assert_response 404
|
||||
end
|
||||
|
||||
def test_new_time_entry_query
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :project_id => 1, :type => 'TimeEntryQuery'
|
||||
assert_response :success
|
||||
assert_select 'input[name=type][value=?]', 'TimeEntryQuery'
|
||||
end
|
||||
|
||||
def test_create_project_public_query
|
||||
@request.session[:user_id] = 2
|
||||
post :create,
|
||||
@@ -263,6 +270,26 @@ class QueriesControllerTest < ActionController::TestCase
|
||||
assert_equal Query::VISIBILITY_PUBLIC, query.visibility
|
||||
end
|
||||
|
||||
def test_create_project_public_time_entry_query
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
q = new_record(TimeEntryQuery) do
|
||||
post :create,
|
||||
:project_id => 'ecookbook',
|
||||
:type => 'TimeEntryQuery',
|
||||
:default_columns => '1',
|
||||
:f => ["spent_on"],
|
||||
:op => {"spent_on" => "="},
|
||||
:v => { "spent_on" => ["2016-07-14"]},
|
||||
:query => {"name" => "test_new_project_public_query", "visibility" => "2"}
|
||||
end
|
||||
|
||||
assert_redirected_to :controller => 'timelog', :action => 'index', :project_id => 'ecookbook', :query_id => q.id
|
||||
assert q.is_public?
|
||||
assert q.has_default_columns?
|
||||
assert q.valid?
|
||||
end
|
||||
|
||||
def test_edit_global_public_query
|
||||
@request.session[:user_id] = 1
|
||||
get :edit, :id => 4
|
||||
|
||||
@@ -759,6 +759,16 @@ class TimelogControllerTest < ActionController::TestCase
|
||||
assert_equal values.sort, values
|
||||
end
|
||||
|
||||
def test_index_with_query
|
||||
query = TimeEntryQuery.new(:project_id => 1, :name => 'Time Entry Query', :visibility => 2)
|
||||
query.save!
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
get :index, :project_id => 'ecookbook', :query_id => query.id
|
||||
assert_response :success
|
||||
assert_select 'h2', :text => query.name
|
||||
end
|
||||
|
||||
def test_index_atom_feed
|
||||
get :index, :project_id => 1, :format => 'atom'
|
||||
assert_response :success
|
||||
|
||||
Reference in New Issue
Block a user