diff --git a/README.md b/README.md index 445c8d70..e4ab5ce9 100644 --- a/README.md +++ b/README.md @@ -408,7 +408,7 @@ artifact = art.artifacts.deploy("", "", "", "") -# artifact = art.artifacts.deploy("Desktop/myNewFile.txt", "my-repository/my/new/artifact/directory/file.txt", {"retention": "30"}) +# artifact = art.artifacts.deploy("Desktop/myNewFile.txt", "my-repository/my/new/artifact/directory/file.txt", {"retention": ["30"]}) ``` #### Deploy an artifact with checksums diff --git a/pyartifactory/objects/artifact.py b/pyartifactory/objects/artifact.py index a148b8aa..ba837a18 100644 --- a/pyartifactory/objects/artifact.py +++ b/pyartifactory/objects/artifact.py @@ -226,7 +226,7 @@ def _format_properties(self, properties: Dict[str, List[str]]): for k, v in properties.items(): values_str = ",".join(v) properties_param_str += f"{k}={values_str};" - return properties_param_str + return properties_param_str.rstrip(";") def properties(self, artifact_path: str, properties: Optional[List[str]] = None) -> ArtifactPropertiesResponse: """ diff --git a/tests/test_artifacts.py b/tests/test_artifacts.py index 88785f1b..b4127be8 100644 --- a/tests/test_artifacts.py +++ b/tests/test_artifacts.py @@ -410,7 +410,7 @@ def test_set_property_success(): properties_param_str += urllib.parse.quote_plus(f"{k}={values_str};") responses.add( responses.PUT, - f"{URL}/api/storage/{ARTIFACT_PATH}?recursive=1&properties={properties_param_str}", + f"{URL}/api/storage/{ARTIFACT_PATH}?recursive=1&properties={properties_param_str.rstrip('%3B')}", status=200, ) responses.add( @@ -432,7 +432,7 @@ def test_deploy_artifact_with_properties_success(): properties_param_str += f"{k}={values_str};" responses.add( responses.PUT, - f"{URL}/{ARTIFACT_PATH};{properties_param_str}", + f"{URL}/{ARTIFACT_PATH};{properties_param_str.rstrip(';')}", status=200, ) responses.add( @@ -466,7 +466,7 @@ def test_deploy_artifact_with_multiple_properties_success(): properties_param_str += f"{k}={values_str};" responses.add( responses.PUT, - f"{URL}/{ARTIFACT_PATH};{properties_param_str}", + f"{URL}/{ARTIFACT_PATH};{properties_param_str.rstrip(';')}", status=200, ) responses.add( @@ -500,7 +500,7 @@ def test_set_property_fail_artifact_not_found(): properties_param_str += urllib.parse.quote_plus(f"{k}={values_str};") responses.add( responses.PUT, - f"{URL}/api/storage/{NX_ARTIFACT_PATH}?recursive=1&properties={properties_param_str}", + f"{URL}/api/storage/{NX_ARTIFACT_PATH}?recursive=1&properties={properties_param_str.rstrip('%3B')}", status=404, ) artifactory = ArtifactoryArtifact(AuthModel(url=URL, auth=AUTH)) @@ -511,7 +511,7 @@ def test_set_property_fail_artifact_not_found(): @responses.activate def test_set_property_fail_bad_value(): - properties_param_str = urllib.parse.quote_plus(f"{BAD_PROPERTY_NAME}={BAD_PROPERTY_VALUE};") + properties_param_str = urllib.parse.quote_plus(f"{BAD_PROPERTY_NAME}={BAD_PROPERTY_VALUE}") responses.add( responses.PUT, f"{URL}/api/storage/{ARTIFACT_PATH}?recursive=1&properties={properties_param_str}",