comparison test/integration/application_test.rb @ 1337:077b8890835a cannam

Merge from live branch
author Chris Cannam
date Thu, 20 Jun 2013 13:14:02 +0100
parents 433d4f72a19b
children 622f24f53b42 261b3d9a4903
comparison
equal deleted inserted replaced
1304:6137548ba453 1337:077b8890835a
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
31 31
32 def test_set_localization 32 def test_set_localization
33 Setting.default_language = 'en' 33 Setting.default_language = 'en'
34 34
35 # a french user 35 # a french user
36 get 'projects', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' 36 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
37 assert_response :success 37 assert_response :success
38 assert_tag :tag => 'h2', :content => 'Projets' 38 assert_tag :tag => 'h2', :content => 'Projets'
39 assert_equal :fr, current_language 39 assert_equal :fr, current_language
40 40
41 # then an italien user 41 # then an italien user
42 get 'projects', { }, 'Accept-Language' => 'it;q=0.8,en-us;q=0.5,en;q=0.3' 42 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
43 assert_response :success 43 assert_response :success
44 assert_tag :tag => 'h2', :content => 'Progetti' 44 assert_tag :tag => 'h2', :content => 'Progetti'
45 assert_equal :it, current_language 45 assert_equal :it, current_language
46 46
47 # not a supported language: default language should be used 47 # not a supported language: default language should be used
48 get 'projects', { }, 'Accept-Language' => 'zz' 48 get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz'
49 assert_response :success 49 assert_response :success
50 assert_tag :tag => 'h2', :content => 'Projects' 50 assert_tag :tag => 'h2', :content => 'Projects'
51 end 51 end
52 52
53 def test_token_based_access_should_not_start_session 53 def test_token_based_access_should_not_start_session
58 rss_key = User.find(2).rss_key 58 rss_key = User.find(2).rss_key
59 get "issues/4.atom?key=#{rss_key}" 59 get "issues/4.atom?key=#{rss_key}"
60 assert_response 200 60 assert_response 200
61 assert_nil session[:user_id] 61 assert_nil session[:user_id]
62 end 62 end
63
64 def test_missing_template_should_respond_with_404
65 get '/login.png'
66 assert_response 404
67 end
63 end 68 end