Skip to content

Commit

Permalink
test: update test depending on updated Git repository test data (#157)
Browse files Browse the repository at this point in the history
Test failed with master because test data about Git repository is
updated in the following commit.

ref:
redmine/redmine@c1eff66
  • Loading branch information
otegami authored Jul 17, 2024
1 parent 735f46d commit 45256e5
Showing 1 changed file with 103 additions and 46 deletions.
149 changes: 103 additions & 46 deletions test/unit/full_text_search/change_git_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,54 +29,111 @@ def test_fetch_changesets
container_type_id: Type.repository.id).
order(source_id: :asc)
first_change = Change.find_by!(path: "images/edit.png")
last_change = Change.where(path: "issue-8857/test01.txt").last
assert_equal([
[
"images/edit.png",
"copied_README",
"new_file.txt",
"renamed_test.txt",
"sources/watchers_controller.rb",
"this_is_a_really_long_and_verbose_directory_name/this_is_because_of_a_simple_reason/it_is_testing_the_ability_of_redmine_to_use_really_long_path_names/These_names_exceed_255_chars_in_total/That_is_the_single_reason_why_we_have_this_directory_here/But_there_might_also_be_additonal_reasons/And_then_there_is_not_even_somthing_funny_in_here.txt",
"filemane with spaces.txt",
" filename with a leading space.txt ",
"latin-1/test00.txt",
"README",
"latin-1-dir/make-latin-1-file.rb",
"issue-8857/test00.txt",
"issue-8857/test01.txt",
],
{
"project_id" => @project.id,
"source_id" => first_change.id,
"source_type_id" => Type.change.id,
"last_modified_at" => parse_time("2007-12-14T09:24:01Z"),
"registered_at" => parse_time("2007-12-14T09:24:01Z"),
"container_id" => repository.id,
"container_type_id" => Type.repository.id,
"title" => "images/edit.png",
"content" => "",
"custom_field_id" => null_number,
"is_private" => null_boolean,
"tag_ids" => [Tag.extension("png").id],
},
{
"project_id" => @project.id,
"source_id" => last_change.id,
"source_type_id" => Type.change.id,
"last_modified_at" => parse_time("2011-01-01T03:00:00Z"),
"registered_at" => parse_time("2011-01-01T03:00:00Z"),
"container_id" => repository.id,
"container_type_id" => Type.repository.id,
"custom_field_id" => null_number,
"title" => "issue-8857/test01.txt",
"content" => <<-CONTENT,
# Redmine master over v5.2 uses the updated Git repository test data.
if Gem::Version.new(Redmine::VERSION.to_s) < Gem::Version.new("5.2") &&
Redmine::VERSION::BRANCH != "devel"
first_change = Change.find_by!(path: "images/edit.png")
last_change = Change.where(path: "issue-8857/test01.txt").last
expected_titles = [
"images/edit.png",
"copied_README",
"new_file.txt",
"renamed_test.txt",
"sources/watchers_controller.rb",
"this_is_a_really_long_and_verbose_directory_name/this_is_because_of_a_simple_reason/it_is_testing_the_ability_of_redmine_to_use_really_long_path_names/These_names_exceed_255_chars_in_total/That_is_the_single_reason_why_we_have_this_directory_here/But_there_might_also_be_additonal_reasons/And_then_there_is_not_even_somthing_funny_in_here.txt",
"filemane with spaces.txt",
" filename with a leading space.txt ",
"latin-1/test00.txt",
"README",
"latin-1-dir/make-latin-1-file.rb",
"issue-8857/test00.txt",
"issue-8857/test01.txt",
]
expected_first_change = {
"project_id" => @project.id,
"source_id" => first_change.id,
"source_type_id" => Type.change.id,
"last_modified_at" => parse_time("2007-12-14T09:24:01Z"),
"registered_at" => parse_time("2007-12-14T09:24:01Z"),
"container_id" => repository.id,
"container_type_id" => Type.repository.id,
"title" => "images/edit.png",
"content" => "",
"custom_field_id" => null_number,
"is_private" => null_boolean,
"tag_ids" => [Tag.extension("png").id],
}
expected_last_change = {
"project_id" => @project.id,
"source_id" => last_change.id,
"source_type_id" => Type.change.id,
"last_modified_at" => parse_time("2011-01-01T03:00:00Z"),
"registered_at" => parse_time("2011-01-01T03:00:00Z"),
"container_id" => repository.id,
"container_type_id" => Type.repository.id,
"custom_field_id" => null_number,
"title" => "issue-8857/test01.txt",
"content" => <<-CONTENT,
test
test
CONTENT
"is_private" => null_boolean,
"tag_ids" => [Tag.extension("txt").id],
}
else
first_change = Change.find_by!(path: "images/edit.png")
last_change = Change.where(path: "issue-8857/test01.txt").last
expected_titles = [
"images/edit.png",
"copied_README",
"renamed_test.txt",
"sources/watchers_controller.rb",
"this_is_a_really_long_and_verbose_directory_name/this_is_because_of_a_simple_reason/it_is_testing_the_ability_of_redmine_to_use_really_long_path_names/These_names_exceed_255_chars_in_total/That_is_the_single_reason_why_we_have_this_directory_here/But_there_might_also_be_additonal_reasons/And_then_there_is_not_even_somthing_funny_in_here.txt",
"filemane with spaces.txt",
" filename with a leading space.txt ",
"new_file.txt",
"latin-1/test00.txt",
"README",
"latin-1-dir/make-latin-1-file.rb",
"issue-8857/test00.txt",
"issue-8857/test01.txt",
]
expected_first_change = {
"project_id" => @project.id,
"source_id" => first_change.id,
"source_type_id" => Type.change.id,
"last_modified_at" => parse_time("2007-12-14T09:24:01Z"),
"registered_at" => parse_time("2007-12-14T09:24:01Z"),
"container_id" => repository.id,
"container_type_id" => Type.repository.id,
"title" => "images/edit.png",
"content" => "",
"custom_field_id" => null_number,
"is_private" => null_boolean,
"tag_ids" => [Tag.extension("png").id],
}
expected_last_change = {
"project_id" => @project.id,
"source_id" => last_change.id,
"source_type_id" => Type.change.id,
"last_modified_at" => parse_time("2011-01-01T03:00:00Z"),
"registered_at" => parse_time("2011-01-01T03:00:00Z"),
"container_id" => repository.id,
"container_type_id" => Type.repository.id,
"custom_field_id" => null_number,
"title" => "issue-8857/test01.txt",
"content" => <<-CONTENT,
test
test
CONTENT
"is_private" => null_boolean,
"tag_ids" => [Tag.extension("txt").id],
},
CONTENT
"is_private" => null_boolean,
"tag_ids" => [Tag.extension("txt").id],
}
end
assert_equal([
expected_titles,
expected_first_change,
expected_last_change,
],
[
records.collect(&:title),
Expand Down

0 comments on commit 45256e5

Please sign in to comment.