Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
eossr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ESCAPE2020
WP3
eossr
Commits
3a8b26bf
Commit
3a8b26bf
authored
2 years ago
by
Vuillaume
Browse files
Options
Downloads
Patches
Plain Diff
Hot fix sandbox test upload new version
parent
236d4d25
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!223
Hot fix sandbox test upload new version
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
eossr/api/zenodo/tests/test_zenodo.py
+6
-4
6 additions, 4 deletions
eossr/api/zenodo/tests/test_zenodo.py
eossr/scripts/zenodo_user_entries_cleanup.py
+7
-1
7 additions, 1 deletion
eossr/scripts/zenodo_user_entries_cleanup.py
with
13 additions
and
5 deletions
eossr/api/zenodo/tests/test_zenodo.py
+
6
−
4
View file @
3a8b26bf
...
...
@@ -98,10 +98,12 @@ class TestZenodoAPITokenSandbox(unittest.TestCase):
self
.
zenodo
.
erase_entry
(
new_record_id
)
print
(
f
"
{
new_record_id
}
created and deleted
"
)
# update existing one
new_record_id
=
self
.
zenodo
.
upload_dir_content
(
tmpdirname
,
record_id
=
eossr_test_lib_id
,
publish
=
False
)
self
.
zenodo
.
erase_entry
(
new_record_id
)
print
(
f
"
{
new_record_id
}
created and deleted
"
)
# update existing record
# Test deactivated on July 2022 as making new versions of records seems not possible anymore on sandbox,
# and I am reluctant to do unit tests directly on Zenodo.
# new_record_id = self.zenodo.upload_dir_content(tmpdirname, record_id=eossr_test_lib_id, publish=False)
# self.zenodo.erase_entry(new_record_id)
# print(f"{new_record_id} created and deleted")
@pytest.mark.skipif
(
os
.
getenv
(
'
SANDBOX_ZENODO_TOKEN_GARCIA
'
)
is
None
,
reason
=
"
SANDBOX_ZENODO_TOKEN_GARCIA not defined
"
...
...
This diff is collapsed.
Click to expand it.
eossr/scripts/zenodo_user_entries_cleanup.py
+
7
−
1
View file @
3a8b26bf
...
...
@@ -3,8 +3,10 @@ Simple code to delete all user entries that have not been published
"""
import
argparse
import
os
import
warnings
from
eossr.api.zenodo
import
ZenodoAPI
from
eossr.api.zenodo.http_status
import
HTTPStatusError
def
zenodo_cleanup
(
token
,
sandbox
=
True
):
...
...
@@ -22,7 +24,11 @@ def zenodo_cleanup(token, sandbox=True):
for
rec
in
use
.
json
():
if
not
rec
[
'
submitted
'
]:
print
(
f
"
Record
{
rec
[
'
id
'
]
}
...
"
)
zen
.
erase_entry
(
rec
[
'
id
'
])
try
:
zen
.
erase_entry
(
rec
[
'
id
'
])
except
HTTPStatusError
as
e
:
warnings
.
warn
(
f
"
Error deleting record
{
rec
[
'
id
'
]
}
:
\n
{
e
}
"
)
continue
def
build_argparser
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment