Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #12597: remove extraneous method definition in the DNS API tests #350

Closed
wants to merge 1 commit into from

Conversation

sodabrew
Copy link
Member

@sodabrew
Copy link
Member Author

@witlessbird Could you take a look at the test failure? I removed the extra method definition, which seems to be blocking this test before, and now that it is executing it fails. Was originally added in 42b9581

   def test_delete_returns_error_if_value_is_missing
     delete '/'
     assert_equal 400, last_response.status
   end

Smart Proxy is returning 404 in this case. That seems correct to me?

@domcleal
Copy link
Contributor

Oops, sorry about the failure, I should've noticed that in the review and also re-run tests with the new rubocop.

Either 404 or 400 seems reasonable to me. Returning 400 as dns_api.rb intends would require changing the route to /:value?, but since the value isn't actually optional (that's the point of the nil check) then returning 404 seems OK as the route DELETE / isn't valid. I'd say removing the check and expecting 404 is probably OK.

@dmitri-d
Copy link
Member

I'm not sure why it's returning 404 (this implies parameter validator isn't catching that the required parameter is missing), let me look into this. I think I favour returning a 400, but 404 seems reasonable too.

@domcleal
Copy link
Contributor

I'm not sure why it's returning 404 (this implies parameter validator isn't catching that the required parameter is missing)

The route doesn't match. It's defined as delete '/:value' which implies :value must be present. Adding a ? would make the value optional, which would trigger the validator.

@domcleal
Copy link
Contributor

Adding a ? would make the value optional, which would trigger the validator.

A thought - it looks like all other delete routes are the same, so we probably shouldn't change just this one.

@dmitri-d
Copy link
Member

Of course, always forget this bit. Agree that the behaviour in this case should match other 'delete' calls.

@theforeman-bot
Copy link
Member

There were the following issues with the commit message:

  • 0914c05 must be in the format fixes #redmine_number - brief description.
  • af4b48b must be in the format fixes #redmine_number - brief description.

If you don't have a ticket number, please create an issue in Redmine, selecting the appropriate project.

More guidelines are available on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@sodabrew
Copy link
Member Author

@witlessbird I merged in your further change - thank you! I will be offline a lot this week for the US Thanksgiving holiday. Please let me know if I need to squash on this branch, if it it'll get taken care of in a squash-cherry-pick to develop?

@dmitri-d
Copy link
Member

@sodabrew: could you squash the commits please?

@sodabrew
Copy link
Member Author

ok, got me while I'm still sitting at the desk!

And removed redundant validation in dns api 'delete' call
@dmitri-d
Copy link
Member

merged in bef9bee. Thanks, @sodabrew!

@dmitri-d dmitri-d closed this Nov 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants