Skip to content
Snippets Groups Projects

add class method tests

Merged Enrique Garcia requested to merge more_tests into master
1 file
+ 46
16
Compare changes
  • Side-by-side
  • Inline
+ 46
16
@@ -2,11 +2,10 @@
import json
import unittest
# import tempfile
# import requests
import requests
from pathlib import Path
from os import remove
from os.path import dirname, realpath
from os.path import dirname, realpath, join
from zenodoci.zenodoapi import ZenodoAPI
@@ -48,19 +47,50 @@ class TestZenodoAPI(unittest.TestCase):
assert z.proj_root_dir == Path(ROOT_DIR)
assert isinstance(z.proj_root_dir, (Path, str))
# def test_zenodo_api_methods(self):
# token = 'FakeToken'
# z = ZenodoAPI(access_token=token,
# sandbox=False,
# proj_root_dir=ROOT_DIR)
#
# url = f'https://zenodo.org/api/deposit/depositions'
# test = requests.get(url)
#
# fetch_user_entry = z.fetch_user_entries()
#
# # self.assertIsInstance(fetch_user_entry, test)
# assert isinstance(fetch_user_entry, requests.get(url=url))
def test_zenodo_api_methods(self):
token = 'FakeToken'
z = ZenodoAPI(access_token=token,
sandbox=False,
proj_root_dir=ROOT_DIR)
test_id = '42'
z.search_codemeta_file()
test_filename = join(ROOT_DIR, z.path_codemeta_file)
path_test_filename = './'
fetch_user_entry = z.fetch_user_entries()
create_new_entry = z.create_new_entry()
# upload_file_entry = z.upload_file_entry(
# entry_id=test_id,
# name_file=test_filename,
# path_file=path_test_filename
# )
upload_metadata_entry = z.update_metadata_entry(
entry_id=test_id,
json_metadata=test_filename
)
erase_entry = z.erase_entry(
entry_id=test_id
)
erase_file_entry = z.erase_file_entry(
entry_id=test_id,
file_id=test_id
)
publish_entry = z.publish_entry(
entry_id=test_id
)
new_version_entry = z.new_version_entry(
entry_id=test_id
)
assert isinstance(fetch_user_entry, requests.models.Response)
assert isinstance(create_new_entry, requests.models.Response)
# assert isinstance(upload_file_entry, requests.models.Response)
assert isinstance(upload_metadata_entry, requests.models.Response)
assert isinstance(erase_entry, requests.models.Response)
assert isinstance(erase_file_entry, requests.models.Response)
assert isinstance(publish_entry, requests.models.Response)
assert isinstance(new_version_entry, requests.models.Response)
def test_search_codemeta_file(self):
token = 'FakeToken'
Loading