From 6a4df7cb26d9d19facc4f85d83ba00bd01e7cc16 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:39:21 -0400 Subject: [PATCH] [6.14.z] Missing content ID test (#12784) --- tests/foreman/api/test_repository.py | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/foreman/api/test_repository.py b/tests/foreman/api/test_repository.py index bd63ad606cf..e6f03383dc2 100644 --- a/tests/foreman/api/test_repository.py +++ b/tests/foreman/api/test_repository.py @@ -1549,6 +1549,40 @@ def test_positive_sync_kickstart_check_os( ) assert len(os) + @pytest.mark.tier2 + @pytest.mark.parametrize( + 'repo_options', + **datafactory.parametrized( + {'yum': {'content_type': 'yum', 'unprotected': True, 'url': 'http://example.com'}} + ), + indirect=True, + ) + def test_missing_content_id(self, repo): + """Handle several cases of missing content ID correctly + + :id: f507790a-933b-4b3f-ac93-cade6967fbd2 + + :parametrized: yes + + :expectedresults: Repository URL can be set to something new and the repo can be deleted + + :BZ:2032040 + """ + # Wait for async metadata generate task to finish + time.sleep(5) + # Get rid of the URL + repo.url = '' + repo = repo.update(['url']) + assert repo.url is None + # Now change the URL back + repo.url = 'http://example.com' + repo = repo.update(['url']) + assert repo.url == 'http://example.com' + # Now delete the Repo + repo.delete() + with pytest.raises(HTTPError): + repo.read() + class TestDockerRepository: """Tests specific to using ``Docker`` repositories."""