Skip to content

Commit

Permalink
get unit tests working, bug fix loading people data
Browse files Browse the repository at this point in the history
  • Loading branch information
RayPlante committed Sep 18, 2024
1 parent d9f4780 commit 9d08dbd
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: scripts/testall.docker python

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-artifacts
Expand Down
2 changes: 1 addition & 1 deletion docker/midasserver/midas-dmpdapnsd_conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ services:
data:
dir: /data/nsd
person_file: person.json
org_file: nistorg.json
org_file: orgs.json
conventions:
nsd1:
about:
Expand Down
2 changes: 1 addition & 1 deletion python/nistoar/midas/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def handle_path_request(self, path: str, env: Mapping, start_resp: Callable, who
def load_people_from(self, datadir=None):
if any(k.startswith("nsd/") for k in self.subapps.keys()):
nsdapp = [v for k,v in self.subapps.items() if k.startswith("nsd/")][0]
nsdapp.load_from()
nsdapp.load_from(datadir)


app = MIDASApp
Expand Down
4 changes: 2 additions & 2 deletions python/nistoar/nsd/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ def load(self, config, log=None, clear=True, withtrans=False):
personfile = config.get('person_file', "person.json")
orgfile = config.get('org_file', "orgs.json")
if not os.path.isfile(os.path.join(datadir, personfile)):
raise ConfigurationException(f"{personfile}: NSD data does not exist as a file")
raise ConfigurationException(f"{personfile}: NSD data does not exist as a file in {datadir}")
if not os.path.isfile(os.path.join(datadir, orgfile)):
raise ConfigurationException(f"{orgfile}: NSD data does not exist as a file")
raise ConfigurationException(f"{orgfile}: NSD data does not exist as a file in {datadir}")

if not withtrans:
self._load_notrans(datadir, personfile, orgfile, log, clear)
Expand Down
2 changes: 1 addition & 1 deletion python/nistoar/nsd/wsgi/nsd1.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def load_from(self, datadir=None):
datacfg.setdefault("dir", "/data/nsd")
if datadir:
datacfg = dict(self.cfg.items())
datacfg['datadir'] = datadir
datacfg['dir'] = str(datadir)
self.svc.load(datacfg, self.log, True)

PeopleServiceApp = NSDServiceApp
Expand Down
2 changes: 1 addition & 1 deletion python/nistoar/web/rest/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def __init__(self, config: Mapping, log: Logger, base_ep: str = None, name: str
self.name = self.cfg.get("name", "")
self.base_ep = None
if not base_ep:
base_ep = self.cfg.get("base_ep")
base_ep = self.cfg.get("base_ep", "")
base_ep = base_ep.strip('/')
if base_ep:
self.base_ep = '/%s/' % base_ep
Expand Down
1 change: 1 addition & 0 deletions python/tests/nistoar/midas/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,7 @@ def setUp(self):
os.path.join(self.workdir, 'nerdm')
self.config['services']['nsd']['db_url'] = os.environ.get("MONGO_TESTDB_URL",
"mongodb://admin:admin@localhost/testdb")
self.config['services']['nsd']['data']['dir'] = str(peopledatadir)
cliagents = {'ark:/88434/tl0-0001': ["Unit testing agent"]}
self.config['authentication'] = { "key": "XXXXX", "algorithm": "HS256", "require_expiration": False,
'client_agents': cliagents }
Expand Down

0 comments on commit 9d08dbd

Please sign in to comment.