mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 19:47:14 +00: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:
parent
fbca88afc4
commit
1ebb8920d2
@ -184,8 +184,13 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
|
||||
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')
|
||||
# User and password authentication is disabled when twofa is enabled
|
||||
# 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_select 'twofa_scheme', 0
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user