[openstreetmap/openstreetmap-website] Add user block api call (PR #4301)
Anton Khorev
notifications at github.com
Sat Oct 21 17:00:03 UTC 2023
@AntonKhorev commented on this pull request.
> + post api_user_blocks_path(:user => blocked_user.id, :reason => "because", :period => 1), :headers => auth_header
+ assert_response :not_found
+ assert_equal "text/plain", @response.media_type
+
+ assert_empty blocked_user.blocks
+ end
+
+ [
+ ["missing reason", "No reason was given", { :period => "10" }],
+ ["missing period", "No period was given", { :reason => "because" }],
+ ["non-numeric period", "Period one is in a wrong format", { :reason => "because", :period => "one" }],
+ ["negative period", "Period must be between 0 and #{UserBlock::PERIODS.max}", { :reason => "go away", :period => "-1" }],
+ ["excessive period", "Period must be between 0 and #{UserBlock::PERIODS.max}", { :reason => "go away", :period => "10000000" }],
+ ["unknown needs_view", "Needs_view must be true if provided", { :reason => "because", :period => "1", :needs_view => "maybe" }]
+ ].each do |name, message, params|
+ test "create invalid because #{name}" do
did private method with (message, params) arguments
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4301#discussion_r1367765959
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4301/review/1691299378 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231021/c2c093c4/attachment.htm>
More information about the rails-dev
mailing list