Skip to content

Commit

Permalink
Add basic auth to content removal test
Browse files Browse the repository at this point in the history
We were getting failed tests on ContentUnitRemoveTestCase because
the delete was being made by the requests library client without
any any credentials.

Then, we would get 403 (forbidden) instead of 405 (method now allowed).

This assumes the delete requires auth in the first place.

Backported from: bc957d1
  • Loading branch information
pedro-psb authored and dralley committed Nov 6, 2024
1 parent cd1d1b7 commit e3b3e58
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pulp_rpm/tests/functional/api/test_crud_content_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ def do_test_remove_unit(self, remote_url):
repo_content = get_content(repo.to_dict())
base_addr = self.cfg.get_host_settings()[0]["url"]

basic_auth = requests.auth.HTTPBasicAuth("admin", "password")
for content_type in repo_content.keys():
response = requests.delete(
urljoin(base_addr, repo_content[content_type][0]["pulp_href"])
urljoin(base_addr, repo_content[content_type][0]["pulp_href"]), auth=basic_auth
)
self.assertEqual(response.status_code, 405)

Expand Down

0 comments on commit e3b3e58

Please sign in to comment.