Feature #34766 ยป add_test.patch
| test/integration/api_test/api_test.rb | ||
|---|---|---|
| 57 | 57 |
assert_response :no_content |
| 58 | 58 |
assert_equal '', response.body |
| 59 | 59 |
end |
| 60 | ||
| 61 |
def test_api_with_accept_header |
|
| 62 |
get '/users/1.xml', :headers => credentials('admin').merge({'Accept' => 'application/xml', 'Content-type' => 'application/xml'})
|
|
| 63 |
assert_response :success |
|
| 64 |
end |
|
| 65 | ||
| 66 |
def test_api_with_accept_header_that_does_not_match_url |
|
| 67 |
get '/users/1', :headers => credentials('admin').merge({'Accept' => 'application/xml', 'Content-type' => 'application/xml'})
|
|
| 68 | ||
| 69 |
assert_response :not_acceptable |
|
| 70 |
assert_equal "We couldn't handle your request, sorry. If you were trying to access the API, make sure to append .json or .xml to your request URL.\n", response.body |
|
| 71 |
end |
|
| 60 | 72 |
end |