55from pathlib import Path
66from datetime import datetime
77
8- import soca .commands .portal .metadata as md
9- import soca .commands .portal .portal as portal
10- import soca .commands .create_summary as summary
8+ import src . soca .commands .portal .metadata as md
9+ import src . soca .commands .portal .portal as portal
10+ import src . soca .commands .create_summary as summary
1111#from ..src.soca.commands.portal.metadata import metadata as m
12- import soca .commands .extract_metadata as ex
12+ import src . soca .commands .extract_metadata as ex
1313
1414
1515class test_soca (TestCase ):
@@ -435,6 +435,9 @@ def test_r4r(self):
435435 r4r .html_repo_icons ()
436436 pass
437437
438+
439+
440+ #TODO move into its own class, for summary testing
438441 def test_ontology (self ):
439442 path = Path (__file__ ).parent / "json_files" / "ontologytest.json"
440443 with path .open () as f :
@@ -446,6 +449,29 @@ def test_ontology(self):
446449 if len (dir ) == 0 :
447450 os .rmdir (path2 )
448451 pass
452+
453+ #Tests for issues/repos that cause problems metadata.py
454+
455+ def test_issue111 (self ):
456+ """This is to test CFF extraction"""
457+ path = Path (__file__ ).parent / "json_files" / "issue_111_mapeathor.json"
458+ with path .open () as f :
459+ mapjayson = json .load (f )
460+ f .close ()
461+ meta = md .metadata (path , mapjayson )
462+ result = meta .citations ()
463+ assert (result ['cff' ])
464+ def test_issue111_2 (self ):
465+ """Mapeathor test to see if the card is built properly"""
466+ path = Path (__file__ ).parent / "json_files" / "issue_111_mapeathor.json"
467+ with path .open () as f :
468+ mapjayson = json .load (f )
469+ f .close ()
470+ meta = md .metadata (path , mapjayson )
471+ res = meta .html_repo_icons ()
472+ result = "cff-version: 1.0.0" in res
473+ self .assertTrue (result )
474+
449475
450476
451477if __name__ == '__main__' :
0 commit comments