Feature #36303 » 36303.patch
app/views/users/index.api.rsb | ||
---|---|---|
11 | 11 |
api.updated_on user.updated_on |
12 | 12 |
api.last_login_on user.last_login_on |
13 | 13 |
api.passwd_changed_on user.passwd_changed_on |
14 |
api.avatar_url gravatar_url(user.mail, {rating: nil, size: nil}) |
|
14 | 15 |
api.twofa_scheme user.twofa_scheme |
15 | 16 | |
16 | 17 |
render_api_custom_values user.visible_custom_field_values, api |
app/views/users/show.api.rsb | ||
---|---|---|
9 | 9 |
api.updated_on @user.updated_on |
10 | 10 |
api.last_login_on @user.last_login_on |
11 | 11 |
api.passwd_changed_on @user.passwd_changed_on |
12 |
api.avatar_url gravatar_url(@user.mail, {rating: nil, size: nil}) |
|
12 | 13 |
api.twofa_scheme @user.twofa_scheme if User.current.admin? || (User.current == @user) |
13 | 14 |
api.api_key @user.api_key if User.current.admin? || (User.current == @user) |
14 | 15 |
api.status @user.status if User.current.admin? |
test/integration/api_test/users_test.rb | ||
---|---|---|
25 | 25 |
test "GET /users.xml should return users" do |
26 | 26 |
users = User.active.order('login') |
27 | 27 |
users.last.update(twofa_scheme: 'totp') |
28 |
get '/users.xml', :headers => credentials('admin') |
|
28 |
Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do |
|
29 |
get '/users.xml', :headers => credentials('admin') |
|
30 |
end |
|
29 | 31 | |
30 | 32 |
assert_response :success |
31 | 33 |
assert_equal 'application/xml', response.media_type |
... | ... | |
38 | 40 | |
39 | 41 |
# No one has changed password. |
40 | 42 |
assert_select user_element, 'passwd_changed_on', :text => '' |
43 |
assert_select user_element, 'avatar_url', :text => %r|\Ahttps://gravatar.com/avatar/\h{32}| |
|
41 | 44 | |
42 | 45 |
if user == users.last |
43 | 46 |
assert_select user_element, 'twofa_scheme', :text => 'totp' |
... | ... | |
78 | 81 |
end |
79 | 82 | |
80 | 83 |
test "GET /users/:id.xml should return the user" do |
81 |
get '/users/2.xml' |
|
84 |
Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do |
|
85 |
get '/users/2.xml' |
|
86 |
end |
|
82 | 87 | |
83 | 88 |
assert_response :success |
84 | 89 |
assert_select 'user id', :text => '2' |
85 | 90 |
assert_select 'user updated_on', :text => Time.zone.parse('2006-07-19T20:42:15Z').iso8601 |
86 | 91 |
assert_select 'user passwd_changed_on', :text => '' |
92 |
assert_select 'user avatar_url', :text => %r|\Ahttps://gravatar.com/avatar/\h{32}| |
|
87 | 93 |
end |
88 | 94 | |
89 | 95 |
test "GET /users/:id.json should return the user" do |