Actions
Defect #29883
closedAttachmentsVisibilityTest and Redmine::AttachmentFieldFormatTest fail randomly due to uninitialized User.current
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
It looks like test/functional/attachments_visibility_test.rb has an unspecified dependency on the value of User.current. To reproduce:
bin/rails test test/integration/api_test/authentication_test.rb test/functional/attachments_visibility_test.rb --seed 53775 => Failure: AttachmentsVisibilityTest#test_attachment_should_be_visible [/Users/gilad/Workspace/redmine/test/functional/attachments_visibility_test.rb:43]: Expected response to be a <2XX: success>, but was a <403: Forbidden>
Environment: Redmine version 3.4.6.devel Ruby version 2.4.1-p111 (2017-03-22) [x86_64-darwin17] Rails version 5.2.1 Environment production Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp Redmine plugins: no plugin installed
There are several tests that change User.current and don't reset the value to nil during teardown. In this case the culprit was the authorization_test.rb but I believe there are other tests that could potentially cause the same problem. I suggest adding `User.current = nil` to `setup` in the failing attachments_visibility_test.rb, and also adding the same to `teardown` in authorization_test.rb.
Files
Actions