Skip to content

Commit

Permalink
userspacegen: Mock setup_target_rhui_access_if_needed as no-op
Browse files Browse the repository at this point in the history
The setup_target_rhui_access_if_needed() function is not covered by
tests and makes tests fail outside of containers because it calls
commands (api.run) which are not mocked.

Jira: OAMG-11647
  • Loading branch information
matejmatuska authored and pirat89 committed Aug 9, 2024
1 parent d62efb2 commit a8c5664
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,7 @@ def perform():
target_iso = next(api.consume(TargetOSInstallationImage), None)
with mounting.mount_upgrade_iso_to_root_dir(overlay.target, target_iso):

# TODO: this is out of tests completely
setup_target_rhui_access_if_needed(context, indata)

target_repoids = _gather_target_repositories(context, indata, prod_cert_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@ def test_perform_ok(monkeypatch):
monkeypatch.setattr(overlaygen, 'create_source_overlay', MockedMountingBase)
monkeypatch.setattr(userspacegen, '_gather_target_repositories', lambda *x: repoids)
monkeypatch.setattr(userspacegen, '_create_target_userspace', lambda *x: None)
monkeypatch.setattr(userspacegen, 'setup_target_rhui_access_if_needed', lambda *x: None)
monkeypatch.setattr(userspacegen.api, 'current_actor', CurrentActorMocked())
monkeypatch.setattr(userspacegen.api, 'produce', produce_mocked())
monkeypatch.setattr(repofileutils, 'get_repodirs', lambda: ['/etc/yum.repos.d'])
Expand Down

0 comments on commit a8c5664

Please sign in to comment.