コード例 #1
0
    def test_delete_user_fail_if_user_not_found(mocker):
        responses.add(responses.GET,
                      f"{URL}/api/security/users/{NEW_USER.name}",
                      status=404)

        artifactory_user = ArtifactoryUser(AuthModel(url=URL, auth=AUTH))
        mocker.spy(artifactory_user, "get")

        with pytest.raises(UserNotFoundException):
            artifactory_user.delete(NEW_USER.name)

        artifactory_user.get.assert_called_once_with(NEW_USER.name)
コード例 #2
0
    def test_delete_user_success(mocker):
        responses.add(
            responses.GET,
            f"{URL}/api/security/users/{NEW_USER.name}",
            json=USER.dict(),
            status=200,
        )

        responses.add(responses.DELETE,
                      f"{URL}/api/security/users/{NEW_USER.name}",
                      status=204)
        artifactory_user = ArtifactoryUser(AuthModel(url=URL, auth=AUTH))
        mocker.spy(artifactory_user, "get")
        artifactory_user.delete(NEW_USER.name)

        artifactory_user.get.assert_called_once_with(NEW_USER.name)