def test_deploy_artifact_success(mocker):
    responses.add(responses.PUT, f"{URL}/{ARTIFACT_PATH}", status=200)

    responses.add(
        responses.GET,
        f"{URL}/api/storage/{ARTIFACT_PATH}",
        json=FILE_INFO_RESPONSE,
        status=200,
    )
    artifactory = ArtifactoryArtifact(AuthModel(url=URL, auth=AUTH))
    mocker.spy(artifactory, "info")
    artifact = artifactory.deploy(LOCAL_FILE_LOCATION, ARTIFACT_PATH)

    artifactory.info.assert_called_once_with(ARTIFACT_PATH)
    assert artifact.dict() == FILE_INFO.dict()
示例#2
0
def test_deploy_artifact_success(mocker):
    responses.add(responses.PUT, f"{URL}/{ARTIFACT_PATH}", status=200)

    responses.add(
        responses.GET,
        f"{URL}/api/storage/{ARTIFACT_PATH}?properties[=x[,y]]",
        json=ARTIFACT_PROPERTIES.dict(),
        status=200,
    )
    artifactory = ArtifactoryArtifact(AuthModel(url=URL, auth=AUTH))
    mocker.spy(artifactory, "properties")
    artifact = artifactory.deploy(LOCAL_FILE_LOCATION, ARTIFACT_PATH)

    artifactory.properties.assert_called_once_with(ARTIFACT_PATH)
    assert artifact.dict() == ARTIFACT_PROPERTIES.dict()