Skip to content

Commit 6a85826

Browse files
Add test for invalid sonarqube project key
1 parent 66edbf1 commit 6a85826

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/usethis/_integrations/sonarqube/test_sonarqube_config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,18 @@ def test_missing_project_key_section_raises(self, tmp_path: Path):
213213
with pytest.raises(MissingProjectKeyError):
214214
get_sonar_project_properties()
215215

216+
def test_non_string_project_key_raises(self, tmp_path: Path):
217+
with change_cwd(tmp_path), PyprojectTOMLManager():
218+
# Arrange
219+
ensure_pyproject_toml()
220+
PyprojectTOMLManager().set_value(
221+
keys=["tool", "usethis", "sonarqube", "project-key"], value=123
222+
)
223+
224+
# Act, Assert
225+
with pytest.raises(InvalidSonarQubeProjectKeyError):
226+
get_sonar_project_properties()
227+
216228
def test_patch_version_ignored(self, tmp_path: Path):
217229
with change_cwd(tmp_path), PyprojectTOMLManager():
218230
# Arrange

0 commit comments

Comments
 (0)