Include twofa_scheme (two-factor scheme) column when exporting users to CSV (#34241).

Patch by Mizuki ISHIKAWA.


git-svn-id: http://svn.redmine.org/redmine/trunk@20350 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-11-13 01:08:15 +00:00
parent a20eb9b764
commit 167637730d
4 changed files with 32 additions and 7 deletions

View File

@@ -69,15 +69,22 @@ class UsersControllerTest < Redmine::ControllerTest
def test_index_csv
with_settings :default_language => 'en' do
user = User.logged.status(1).first
user.update(passwd_changed_on: Time.current.last_month)
get :index, :params => { :format => 'csv' }
user.update(passwd_changed_on: Time.current.last_month, twofa_scheme: 'totp')
get :index, params: {format: 'csv'}
assert_response :success
assert_equal User.logged.status(1).count, response.body.chomp.split("\n").size - 1
assert_include 'active', response.body
assert_not_include 'locked', response.body
assert_include format_time(user.updated_on), response.body
assert_include format_time(user.passwd_changed_on), response.body
assert_include format_time(user.updated_on), response.body.split("\n").second
assert_include format_time(user.passwd_changed_on), response.body.split("\n").second
# status
assert_include 'active', response.body.split("\n").second
assert_not_include 'locked', response.body.split("\n").second
# twofa_scheme
assert_include 'Authenticator app', response.body.split("\n").second
assert_include 'disabled', response.body.split("\n").third
assert_equal 'text/csv', @response.media_type
end
end