diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-02-25 07:57:37 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-02-25 07:57:37 +0000 |
commit | 1ebb8920d2400f7e505a8508ef17aa6eaf76b5d3 (patch) | |
tree | 0c655fd474f98903cb828fea64f026f8d0074fbd /test/integration | |
parent | fbca88afc43df94d0f3dd9b0283df1769231b88a (diff) | |
download | redmine-1ebb8920d2400f7e505a8508ef17aa6eaf76b5d3.tar.gz redmine-1ebb8920d2400f7e505a8508ef17aa6eaf76b5d3.zip |
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
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/api_test/users_test.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 12198db19..26473356a 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -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 |