プロジェクト

全般

プロフィール

Vote #81204

完了

Fix passing a wrong parameter to assert_select in API test for 'GET /users/:id'

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
152
issue_org_id:
34492
author_id:
332
assigned_to_id:
332
comments:
2
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

At source:tags/4.1.1/test/integration/api_test/users_test.rb#L121, assert_select there tests the element with @User.find(1).status.to_s@. However, it must be @User.find(2).status.to_s@ because the preceding @get@ request retrieves data for user 2.


  test "GET /users/:id should return status for administrators" do
    get '/users/2.xml', :headers => credentials('admin')
    assert_response :success
    assert_select 'user status', :text => User.find(1).status.to_s
  end

The following patch fixes this issue.


diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb
index d54701ad5..bd58a39f2 100644
--- a/test/integration/api_test/users_test.rb
+++ b/test/integration/api_test/users_test.rb
@@ -158,7 +158,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
   test "GET /users/:id should return status for administrators" do
     get '/users/2.xml', :headers => credentials('admin')
     assert_response :success
-    assert_select 'user status', :text => User.find(1).status.to_s
+    assert_select 'user status', :text => User.find(2).status.to_s
   end
 
   test "GET /users/:id should return admin status for current user" do

journals

Setting the target version to 4.2.0.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン4.2.0_152 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0