Project

General

Profile

Refactor #18976

HostsControllerTest REMOTE_USER tests should not assume format of subsequent requests

Added by Dominic Cleal over 5 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Tests
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Under Rails 5.0, two HostsControllerTest tests fails:

HostsControllerTest#test_0037_if only authorize_login_delegation is set, REMOTE_USER should be
ignored for API requests [test/controllers/hosts_controller_test.rb:617]:
Expected response to be a <2XX: success>, but was a <401: Unauthorized>

When making a JSON format request followed by a request with no explicit format, Rails 5 is now memorising that it's requesting application/json instead of resetting to HTML or similar.

This is not a bug in Rails 5, as it shouldn't be assumed that the state will be reset between requests in a single test case: https://github.com/rails/rails/commit/33db42168425866b714203e35a3a36693983b3f9

The format should be set explicitly or moved into separate tests with a common setup.

Associated revisions

Revision 0bb4a75c (diff)
Added by Dominic Cleal over 5 years ago

fixes #18976 - separate tests with different request formats

When making a JSON format request followed by a request with no explicit
format, Rails 5 is now memorising that it's requesting application/json
instead of resetting to HTML or similar. It shouldn't be assumed that
the state is reset between requests within a test (rails/rails@33db421).

History

#1 Updated by The Foreman Bot over 5 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4395 added

#2 Updated by Dominic Cleal over 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Ohad Levy about 5 years ago

  • Legacy Backlogs Release (now unused) set to 209

Also available in: Atom PDF