コード例 #1
0
def test_get_artifact_property_not_found_error():
    responses.add(
        responses.GET,
        f"{URL}/api/storage/{ARTIFACT_PATH}?properties=a_property_not_found",
        json={"errors": [{"status": 404, "message": "No properties could be found."}]},
        status=404,
    )

    artifactory = ArtifactoryArtifact(AuthModel(url=URL, auth=AUTH))
    with pytest.raises(PropertyNotFoundException):
        artifactory.properties(ARTIFACT_PATH, properties=["a_property_not_found"])
コード例 #2
0
def test_get_artifact_all_properties_success():
    responses.add(
        responses.GET,
        f"{URL}/api/storage/{ARTIFACT_PATH}?properties",
        json=ARTIFACT_MULTIPLE_PROPERTIES.dict(),
        status=200,
    )

    artifactory = ArtifactoryArtifact(AuthModel(url=URL, auth=AUTH))
    artifact_properties = artifactory.properties(ARTIFACT_PATH)
    assert artifact_properties.dict() == ARTIFACT_MULTIPLE_PROPERTIES.dict()
コード例 #3
0
def test_get_artifact_single_property_success():
    responses.add(
        responses.GET,
        f"{URL}/api/storage/{ARTIFACT_PATH}?properties=prop1",
        json=ARTIFACT_ONE_PROPERTY.dict(),
        status=200,
    )

    artifactory = ArtifactoryArtifact(AuthModel(url=URL, auth=AUTH))
    artifact_properties = artifactory.properties(ARTIFACT_PATH, ["prop1"])
    assert artifact_properties.dict() == ARTIFACT_ONE_PROPERTY.dict()
コード例 #4
0
def test_get_artifact_multiple_properties_with_non_existing_properties_success(
):
    responses.add(
        responses.GET,
        f"{URL}/api/storage/{ARTIFACT_PATH}?properties=prop1,prop2,non_existing_prop",
        json=ARTIFACT_MULTIPLE_PROPERTIES.dict(),
        status=200,
    )

    artifactory = ArtifactoryArtifact(AuthModel(url=URL, auth=AUTH))
    artifact_properties = artifactory.properties(
        ARTIFACT_PATH, ["prop1", "prop2", "non_existing_prop"])
    assert artifact_properties.dict() == ARTIFACT_MULTIPLE_PROPERTIES.dict()