##// END OF EJS Templates
add tests to export issues csv in Traditional Chinese and French for csv separator (#8368)...
Toshi MARUYAMA -
r7823:0eed9198eb3e
parent child
Show More
@@ -380,6 +380,64 class IssuesControllerTest < ActionController::TestCase
380 end
380 end
381 end
381 end
382
382
383 def test_index_csv_tw
384 with_settings :default_language => "zh-TW" do
385 str1 = "test_index_csv_tw"
386 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3,
387 :status_id => 1, :priority => IssuePriority.all.first,
388 :subject => str1, :estimated_hours => '1234.5')
389 assert issue.save
390 assert_equal 1234.5, issue.estimated_hours
391
392 get :index, :project_id => 1,
393 :f => ['subject'],
394 :op => '=', :values => [str1],
395 :c => ['estimated_hours', 'subject'],
396 :format => 'csv',
397 :set_filter => 1
398 assert_equal 'text/csv', @response.content_type
399 lines = @response.body.chomp.split("\n")
400 assert_equal "#{issue.id},1234.5,#{str1}", lines[1]
401
402 str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)"
403 if str_tw.respond_to?(:force_encoding)
404 str_tw.force_encoding('UTF-8')
405 end
406 assert_equal str_tw, l(:general_lang_name)
407 assert_equal ',', l(:general_csv_separator)
408 assert_equal '.', l(:general_csv_decimal_separator)
409 end
410 end
411
412 def test_index_csv_fr
413 with_settings :default_language => "fr" do
414 str1 = "test_index_csv_fr"
415 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3,
416 :status_id => 1, :priority => IssuePriority.all.first,
417 :subject => str1, :estimated_hours => '1234.5')
418 assert issue.save
419 assert_equal 1234.5, issue.estimated_hours
420
421 get :index, :project_id => 1,
422 :f => ['subject'],
423 :op => '=', :values => [str1],
424 :c => ['estimated_hours', 'subject'],
425 :format => 'csv',
426 :set_filter => 1
427 assert_equal 'text/csv', @response.content_type
428 lines = @response.body.chomp.split("\n")
429 assert_equal "#{issue.id};1234,5;#{str1}", lines[1]
430
431 str_fr = "Fran\xc3\xa7ais"
432 if str_fr.respond_to?(:force_encoding)
433 str_fr.force_encoding('UTF-8')
434 end
435 assert_equal str_fr, l(:general_lang_name)
436 assert_equal ';', l(:general_csv_separator)
437 assert_equal ',', l(:general_csv_decimal_separator)
438 end
439 end
440
383 def test_index_pdf
441 def test_index_pdf
384 ["en", "zh", "zh-TW", "ja", "ko"].each do |lang|
442 ["en", "zh", "zh-TW", "ja", "ko"].each do |lang|
385 with_settings :default_language => lang do
443 with_settings :default_language => lang do
General Comments 0
You need to be logged in to leave comments. Login now