Skip to content

Commit

Permalink
Remove trailing char from properties
Browse files Browse the repository at this point in the history
  • Loading branch information
aslheyrr committed Sep 19, 2024
1 parent f2d0de3 commit 71f63e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ artifact = art.artifacts.deploy("<LOCAL_FILE_LOCATION>", "<ARTIFACT_PATH_IN_ARTI

```python
artifact = art.artifacts.deploy("<LOCAL_FILE_LOCATION>", "<ARTIFACT_PATH_IN_ARTIFACTORY>", "<PROPERTIES>")
# 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
Expand Down
2 changes: 1 addition & 1 deletion pyartifactory/objects/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/test_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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))
Expand All @@ -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}",
Expand Down

0 comments on commit 71f63e3

Please sign in to comment.