summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/api_test')
-rw-r--r--test/integration/api_test/users_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb
index b79791a7c..d54701ad5 100644
--- a/test/integration/api_test/users_test.rb
+++ b/test/integration/api_test/users_test.rb
@@ -84,7 +84,6 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
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 twofa_scheme', :text => ''
end
test "GET /users/:id.json should return the user" do
@@ -174,6 +173,20 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
assert_select 'user admin', 0
end
+ test "GET /users/:id should not return twofa_scheme for standard user" do
+ User.find(2).update(twofa_scheme: 'totp')
+ get '/users/3.xml', :headers => credentials('jsmith')
+ assert_response :success
+ assert_select 'twofa_scheme', 0
+ end
+
+ test "GET /users/:id should return twofa_scheme for administrators" do
+ User.find(2).update(twofa_scheme: 'totp')
+ get '/users/2.xml', :headers => credentials('admin')
+ assert_response :success
+ assert_select 'twofa_scheme', :text => 'totp'
+ end
+
test "POST /users.xml with valid parameters should create the user" do
assert_difference('User.count') do
post(