Unverified Commit e9288140 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

fix other errors

parent f5cd77b5
Pipeline #16890 passed with stages
in 4 minutes and 13 seconds
......@@ -166,11 +166,18 @@ def _get_access_status(graph, record_id):
for resource in graph:
logging.info(resource)
logging.info("type in resource => {}".format('type' in resource))
logging.info("type == 'access' => {}".format(resource['type'] == 'access'))
if 'type' in resource:
logging.info("type == 'access' => {}".format(resource['type'] == 'access'))
else:
logging.info("type == 'access' => False")
logging.info("regulates in resource => {}".format('regulates' in resource))
logging.info("resource['regulates'].startswith('https://memobase.ch/digital/') => {}"
.format(resource['regulates'].startswith('https://memobase.ch/digital/')))
logging.info("'name' in resource => {}".format('name' in resource))
if 'regulates' in resource:
logging.info("resource['regulates'].startswith('https://memobase.ch/digital/') => {}"
.format(resource['regulates'].startswith('https://memobase.ch/digital/')))
else:
logging\
.info("resource['regulates'].startswith('https://memobase.ch/digital/') => False")
logging.info("name in resource => {}".format('name' in resource))
if 'type' in resource and resource['type'] == 'access' and \
'regulates' in resource and \
resource['regulates'].startswith('https://memobase.ch/digital/') and \
......
......@@ -52,15 +52,15 @@ class Test(TestCase):
def setUp(self) -> None:
os.environ['URI_BASE'] = 'file:///data/'
# def test__get_access_status_if_resource_is_private(self):
# access_status = MediametadataToDB._get_access_status(
# Test._load_file_and_get_res('BAB-PA_43-BAB_MC169A.json', lambda x: x), 'some_rec')
# self.assertEqual(access_status, 'closed')
#
# def test__get_access_status_if_resource_is_public(self):
# access_status = MediametadataToDB._get_access_status(
# Test._load_file_and_get_res('mfk-FLM-167202.json', lambda x: x), 'some_rec')
# self.assertEqual(access_status, 'public')
def test__get_access_status_if_resource_is_private(self):
access_status = MediametadataToDB._get_access_status(
Test._load_file_and_get_res('BAB-PA_43-BAB_MC169A.json', lambda x: x), 'some_rec')
self.assertEqual(access_status, 'closed')
def test__get_access_status_if_resource_is_public(self):
access_status = MediametadataToDB._get_access_status(
Test._load_file_and_get_res('mfk-FLM-167202.json', lambda x: x), 'some_rec')
self.assertEqual(access_status, 'public')
def test__get_values_from_inaccessible_digital_object(self):
res = {
......
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