diff options
author | Go MAEDA <maeda@farend.jp> | 2020-07-28 15:11:39 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-07-28 15:11:39 +0000 |
commit | 36c6426a23bc54c7de27bd5c0eec76ee7c2fa287 (patch) | |
tree | 523c046fc25a353923b945cc8393f2236d9a8bb9 /test/integration/api_test | |
parent | 39d395b72737c9b22af4e2306283f9cc588afa50 (diff) | |
download | redmine-36c6426a23bc54c7de27bd5c0eec76ee7c2fa287.tar.gz redmine-36c6426a23bc54c7de27bd5c0eec76ee7c2fa287.zip |
Include updated_on and passwd_changed_on columns in API response (#33592).
Patch by vzvu 3k6k and Takenori TAKAKI.
git-svn-id: http://svn.redmine.org/redmine/trunk@19940 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test')
-rw-r--r-- | test/integration/api_test/users_test.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 8320b4e0a..6322af2a1 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -28,7 +28,16 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert_response :success assert_equal 'application/xml', response.media_type assert_select 'users' do - assert_select 'user', User.active.count + users = User.active.order('login') + assert_select 'user', :count => users.size do |nodeset| + nodeset.zip(users) do |user_element, user| + assert_select user_element, 'id', :text => user.id.to_s + assert_select user_element, 'updated_on', :text => user.updated_on.iso8601 + + # No one has changed password. + assert_select user_element, 'passwd_changed_on', :text => '' + end + end end end @@ -39,7 +48,17 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') - assert_equal User.active.count, json['users'].size + + users = User.active.order('login') + assert_equal users.size, json['users'].size + + json['users'].zip(users) do |user_json, user| + assert_equal user.id, user_json['id'] + assert_equal user.updated_on.iso8601, user_json['updated_on'] + + # No one has changed password. + assert_nil user_json['passwd_changed_on'] + end end test "GET /users/:id.xml should return the user" do @@ -47,6 +66,8 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert_response :success assert_select 'user id', :text => '2' + assert_select 'user updated_on', :text => '2006-07-19T20:42:15Z' + assert_select 'user passwd_changed_on', :text => '' end test "GET /users/:id.json should return the user" do @@ -57,6 +78,8 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert_kind_of Hash, json assert_kind_of Hash, json['user'] assert_equal 2, json['user']['id'] + assert_equal '2006-07-19T20:42:15Z', json['user']['updated_on'] + assert_nil json['user']['passwd_changed_on'] end test "GET /users/:id.xml with include=memberships should include memberships" do |