]> git.openstreetmap.org Git - rails.git/commitdiff
Make user creation code in unredact test similar to redact tests
authorAnton Khorev <tony29@yandex.ru>
Tue, 11 Feb 2025 04:10:54 +0000 (07:10 +0300)
committerAnton Khorev <tony29@yandex.ru>
Tue, 11 Feb 2025 04:10:54 +0000 (07:10 +0300)
test/controllers/api/old_nodes_controller_test.rb
test/controllers/api/old_ways_controller_test.rb

index 7bea5d9d37906fd35b3eb09b88d5264269b72c3b..0c5faa9f9c0be4f834fc269830631e731d0b67ba 100644 (file)
@@ -289,12 +289,11 @@ module Api
     # test the unredaction of an old version of a node, while being
     # authorised as a normal user.
     def test_unredact_node_normal_user
-      user = create(:user)
       node = create(:node, :with_history, :version => 2)
       old_node = node.old_nodes.find_by(:version => 1)
       redaction = create(:redaction)
       old_node.redact!(redaction)
-      auth_header = bearer_authorization_header user
+      auth_header = bearer_authorization_header
 
       post node_version_redact_path(*old_node.id), :headers => auth_header
 
@@ -306,11 +305,10 @@ module Api
     # test the unredaction of an old version of a node, while being
     # authorised as a moderator.
     def test_unredact_node_moderator
-      moderator_user = create(:moderator_user)
       node = create(:node, :with_history, :version => 2)
       old_node = node.old_nodes.find_by(:version => 1)
       old_node.redact!(create(:redaction))
-      auth_header = bearer_authorization_header moderator_user
+      auth_header = bearer_authorization_header create(:moderator_user)
 
       post node_version_redact_path(*old_node.id), :headers => auth_header
 
index e879c42a962acad6b0765995b25511e825544dc9..6946d2ab1cda8b8e24b52b70394b9875604b9ad8 100644 (file)
@@ -307,11 +307,10 @@ module Api
     # test the unredaction of an old version of a way, while being
     # authorised as a moderator.
     def test_unredact_way_moderator
-      moderator_user = create(:moderator_user)
       way = create(:way, :with_history, :version => 2)
       old_way = way.old_ways.find_by(:version => 1)
       old_way.redact!(create(:redaction))
-      auth_header = bearer_authorization_header moderator_user
+      auth_header = bearer_authorization_header create(:moderator_user)
 
       post way_version_redact_path(*old_way.id), :headers => auth_header