Commit d9ad8204 authored by Enrique Garcia's avatar Enrique Garcia
Browse files

Merge branch 'more_tests' into 'master'

add class method tests

See merge request !16
parents 1d4b7ded 6c4611f1
Pipeline #112435 passed with stages
in 5 minutes and 46 seconds
......@@ -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'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment