Add tests for copr_settings_url after
@@ -27,3 +27,29 @@ class TestCoprHelper:
copr_helper.get_available_chroots.cache_clear()
assert copr_helper.get_available_chroots() == expected_return
+
+ @pytest.mark.parametrize(
+ "owner,project,section,expected_suffix",
+ [
+ (
+ "@rhinstaller",
+ "Anaconda",
+ "permissions",
+ "g/rhinstaller/Anaconda/permissions/",
+ ),
+ ("@rhinstaller", "Anaconda", None, "g/rhinstaller/Anaconda/edit/"),
+ ("someone", "Anaconda", "permissions", "someone/Anaconda/permissions/"),
+ ],
+ )
+ def test_settings_url(self, owner, project, section, expected_suffix):
+ copr_client_mock = flexmock(config={"copr_url": "https://fedoracloud.org"})
+
+ flexmock(packit.copr_helper.CoprClient).should_receive(
+ "create_from_config_file"
+ ).and_return(copr_client_mock)
+ copr_helper = CoprHelper("_upstream_local_project")
+
+ assert (
+ copr_helper.get_copr_settings_url(owner, project, section)
+ == f"https://fedoracloud.org/coprs/{expected_suffix}"
+ )
