mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 23:36:01 +01:00
Update API test to use token based authentication when twofa is enabled for user (#35001).
git-svn-id: http://svn.redmine.org/redmine/trunk@21441 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -184,8 +184,13 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "GET /users/:id should not return twofa_scheme for standard user" do
|
test "GET /users/:id should not return twofa_scheme for standard user" do
|
||||||
User.find(2).update(twofa_scheme: 'totp')
|
# User and password authentication is disabled when twofa is enabled
|
||||||
get '/users/3.xml', :headers => credentials('jsmith')
|
# Use token authentication
|
||||||
|
user = User.find(2)
|
||||||
|
token = Token.create!(:user => user, :action => 'api')
|
||||||
|
user.update(twofa_scheme: 'totp')
|
||||||
|
|
||||||
|
get '/users/3.xml', :headers => credentials(token.value, 'X')
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'twofa_scheme', 0
|
assert_select 'twofa_scheme', 0
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user