Esempio n. 1
0
def test_delete_permission_fail_if_group_not_found(mocker):
    responses.add(
        responses.GET, f"{URL}/api/security/permissions/{PERMISSION.name}", status=404
    )

    artifactory_permission = ArtifactoryPermission(AuthModel(url=URL, auth=AUTH))
    mocker.spy(artifactory_permission, "get")

    with pytest.raises(PermissionNotFoundException):
        artifactory_permission.delete(PERMISSION.name)

    artifactory_permission.get.assert_called_once_with(PERMISSION.name)
def test_delete_permission_fail_if_group_not_found(mocker, api_version,
                                                   permission, api_uri):
    responses.add(responses.GET,
                  f"{URL}/{api_uri}/{permission.name}",
                  status=404)

    artifactory_permission = ArtifactoryPermission(
        AuthModel(url=URL, auth=AUTH, api_version=api_version))
    mocker.spy(artifactory_permission, "get")

    with pytest.raises(PermissionNotFoundException):
        artifactory_permission.delete(permission.name)

    artifactory_permission.get.assert_called_once_with(permission.name)
Esempio n. 3
0
def test_delete_group_success(mocker):
    responses.add(
        responses.GET,
        f"{URL}/api/security/permissions/{PERMISSION.name}",
        json=PERMISSION.dict(),
        status=200,
    )

    responses.add(
        responses.DELETE,
        f"{URL}/api/security/permissions/{PERMISSION.name}",
        status=204,
    )
    artifactory_permission = ArtifactoryPermission(AuthModel(url=URL, auth=AUTH))
    mocker.spy(artifactory_permission, "get")
    artifactory_permission.delete(PERMISSION.name)

    artifactory_permission.get.assert_called_once_with(PERMISSION.name)
def test_delete_group_success(mocker, api_version, permission, api_uri):
    responses.add(
        responses.GET,
        f"{URL}/{api_uri}/{permission.name}",
        json=permission.dict(),
        status=200,
    )

    responses.add(
        responses.DELETE,
        f"{URL}/{api_uri}/{permission.name}",
        status=204,
    )
    artifactory_permission = ArtifactoryPermission(
        AuthModel(url=URL, auth=AUTH, api_version=api_version))
    mocker.spy(artifactory_permission, "get")
    artifactory_permission.delete(permission.name)

    artifactory_permission.get.assert_called_once_with(permission.name)