summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-01-21 00:31:11 +0000
committerGo MAEDA <maeda@farend.jp>2022-01-21 00:31:11 +0000
commit5d0798c0d1b970a4d34b61906907014c3c304d51 (patch)
tree357294683e2aec0b4dd31c1fab1cd10a728105dc /test/integration
parent7ad7d17a35268cca698086783412f52799703b35 (diff)
downloadredmine-5d0798c0d1b970a4d34b61906907014c3c304d51.tar.gz
redmine-5d0798c0d1b970a4d34b61906907014c3c304d51.zip
Include avatar URL in Users API (#36303).
Contributed by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@21375 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/users_test.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb
index 9bf91c61d..12198db19 100644
--- a/test/integration/api_test/users_test.rb
+++ b/test/integration/api_test/users_test.rb
@@ -25,7 +25,11 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
test "GET /users.xml should return users" do
users = User.active.order('login')
users.last.update(twofa_scheme: 'totp')
- get '/users.xml', :headers => credentials('admin')
+ Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do
+ with_settings :gravatar_enabled => '1', :gravatar_default => 'mm' do
+ get '/users.xml', :headers => credentials('admin')
+ end
+ end
assert_response :success
assert_equal 'application/xml', response.media_type
@@ -38,6 +42,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
# No one has changed password.
assert_select user_element, 'passwd_changed_on', :text => ''
+ assert_select user_element, 'avatar_url', :text => %r|\Ahttps://gravatar.com/avatar/\h{32}\?default=mm|
if user == users.last
assert_select user_element, 'twofa_scheme', :text => 'totp'
@@ -78,12 +83,17 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
end
test "GET /users/:id.xml should return the user" do
- get '/users/2.xml'
+ Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do
+ with_settings :gravatar_enabled => '1', :gravatar_default => 'robohash' do
+ get '/users/2.xml'
+ end
+ end
assert_response :success
assert_select 'user id', :text => '2'
assert_select 'user updated_on', :text => Time.zone.parse('2006-07-19T20:42:15Z').iso8601
assert_select 'user passwd_changed_on', :text => ''
+ assert_select 'user avatar_url', :text => %r|\Ahttps://gravatar.com/avatar/\h{32}\?default=robohash|
end
test "GET /users/:id.json should return the user" do