Skip to content

Commit

Permalink
test_inmem.py: mv test data to dbio/data, undo VS style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RayPlante committed Mar 12, 2024
1 parent a2e7449 commit 9be1f53
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
File renamed without changes.
35 changes: 15 additions & 20 deletions python/tests/nistoar/midas/dbio/test_inmem.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os
import json
import pdb
import logging
import os, json, pdb, logging
from pathlib import Path
import unittest as test

Expand All @@ -10,10 +7,13 @@
import json

testuser = PubAgent("test", PubAgent.AUTO, "tester")
asc_andor = 'data/asc_andor.json'
asc_and = 'data/asc_and.json'
asc_or = 'data/asc_or.json'
dmp_path = 'data/dmp.json'
testdir = Path(__file__).parents[0]
datadir = testdir / "data"

asc_andor = datadir / 'asc_andor.json'
asc_and = datadir / 'asc_and.json'
asc_or = datadir / 'asc_or.json'
dmp_path = datadir / 'dmp.json'

with open(asc_or, 'r') as file:
constraint_or = json.load(file)
Expand Down Expand Up @@ -345,22 +345,19 @@ def test_select_records(self):
self.cli._db[base.DMP_PROJECTS][id] = rec.to_dict()

id = "pdr0:0006"
rec = base.ProjectRecord(
base.DMP_PROJECTS, {"id": id, "name": "test 2"}, self.cli)
rec = base.ProjectRecord(base.DMP_PROJECTS, {"id": id, "name": "test 2"}, self.cli)
self.cli._db[base.DMP_PROJECTS][id] = rec.to_dict()

id = "pdr0:0003"
rec = base.ProjectRecord(
base.DMP_PROJECTS, {"id": id, "name": "test3"}, self.cli)
rec = base.ProjectRecord(base.DMP_PROJECTS, {"id": id, "name": "test3"}, self.cli)
self.cli._db[base.DMP_PROJECTS][id] = rec.to_dict()

rec = base.ProjectRecord(
base.DMP_PROJECTS, {"id": "pdr0:0004", "name": "test4"}, self.cli)
rec = base.ProjectRecord(base.DMP_PROJECTS, {"id": "pdr0:0004", "name": "test4"}, self.cli)
self.cli._db[base.DMP_PROJECTS]["pdr0:0004"] = rec.to_dict()

# not working because owner is not self
rec = base.ProjectRecord(
base.DMP_PROJECTS, {"id": "pdr0:0014", "name": "test5","owner":"not_self"}, self.cli)
rec = base.ProjectRecord(base.DMP_PROJECTS, {"id": "pdr0:0014", "name": "test5","owner":"not_self"},
self.cli)
self.cli._db[base.DMP_PROJECTS]["pdr0:0014"] = rec.to_dict()

recs = list(self.cli.select_records(base.ACLs.READ))
Expand Down Expand Up @@ -433,10 +430,8 @@ def test_save_history(self):

def test_record_action(self):
rec = self.cli.create_record("mine1")
self.cli.record_action(
Action(Action.CREATE, "mds3:0001", testuser, "created"))
self.cli.record_action(
Action(Action.COMMENT, "mds3:0001", testuser, "i'm hungry"))
self.cli.record_action(Action(Action.CREATE, "mds3:0001", testuser, "created"))
self.cli.record_action(Action(Action.COMMENT, "mds3:0001", testuser, "i'm hungry"))
acts = self.cli._select_actions_for("mds3:0001")
self.assertEqual(len(acts), 2)
self.assertEqual(acts[0]['type'], Action.CREATE)
Expand Down

0 comments on commit 9be1f53

Please sign in to comment.