示例#1
0
def test_get_local_repository_error_not_found():
    responses.add(responses.GET,
                  f"{URL}/api/repositories/{LOCAL_REPOSITORY.key}",
                  status=404)

    artifactory_repo = ArtifactoryRepository(AuthModel(url=URL, auth=AUTH))
    with pytest.raises(RepositoryNotFoundException):
        artifactory_repo.get_local_repo(LOCAL_REPOSITORY.key)
示例#2
0
def test_get_local_repository_success(mocker):
    responses.add(
        responses.GET,
        f"{URL}/api/repositories/{LOCAL_REPOSITORY.key}",
        json=LOCAL_REPOSITORY_RESPONSE.dict(),
        status=200,
    )

    artifactory_repo = ArtifactoryRepository(AuthModel(url=URL, auth=AUTH))
    mocker.spy(artifactory_repo, "get_local_repo")
    artifactory_repo.get_local_repo(LOCAL_REPOSITORY.key)

    artifactory_repo.get_local_repo.assert_called_once()