Fix a bug where HttpTestContext.assertHTTPCall doesn't verify the URL.

Review Request #14308 — Created Jan. 24, 2025 and submitted

Information

Review Board
release-7.x

Reviewers

Our hosting service unit tests use HttpTestContext.assertHTTPCall to
test whether the right HTTP call was made during tests. The method is
supposed to verify that the given URL is used in the request. However, we
actually had a bug in the way we were accessing the URL argument. We
would try to grab it from **kwargs even though it has its own keyword
argument in the function signature. This made it so that the URL was
never actually checked during unit tests. So even if the URL was wrong,
the unit test wouldn't catch this. This change fixes that so we're
properly grabbing the URL that was passed to assertHTTPCall.

  • Ran unit tests.
  • Changed a unit test so that an incorrect URL was passed to assertHTTPCall,
    saw that it failed whereas before this fix the test would still pass.
  • Tried passing the URL argument positionally instead of by keyword, test
    still passed.
  • Tried passing the URL argument by keyword as the 3rd argument in the list,
    instead of the 2nd (which is its position in the function signature), saw
    that tests still passed.
Summary ID
Fix a bug where HttpTestContext.assertHTTPCall doesn't verify the URL.
Our hosting service unit tests use `HttpTestContext.assertHTTPCall` to test whether the right HTTP call was made during tests. The method is supposed to verify that the given URL is used in the request. However, we actually had a bug in the way we were accessing the URL argument. We would try to grab it from `**kwargs` even though it has its own keyword argument in the function signature. This made it so that the URL was never actually checked during unit tests. So even if the URL was wrong, the unit test wouldn't catch this. This change fixes that so we're properly grabbing the URL that was passed to `assertHTTPCall`.
9a23482934fdf7b267a5a22f26402d6d8991e8d3
chipx86
  1. Oof. Good catch! Thanks for fixing this.

  2. 
      
david
  1. Ship It!
  2. 
      
maubin
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.x (dbf3c57)
Loading...