Skip to content

Commit

Permalink
test with more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Loembe committed May 22, 2024
1 parent 298b0b6 commit 5e5b0ce
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
- type: volume
source: MONGO_CONFIG
target: /data/configdb

mongo-express:
image: mongo-express:latest
container_name: mongo-express
Expand Down
1 change: 1 addition & 0 deletions python/nistoar/midas/dbio/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def select_records(self, perm: base.Permissions=base.ACLs.OWN, **cnsts) -> Itera

def adv_select_records(self, filter: dict,
perm: base.Permissions=base.ACLs.OWN) -> Iterator[base.ProjectRecord]:
print(filter)
if base.DBClient.check_query_structure(filter):
if isinstance(perm, str):
perm = [perm]
Expand Down
46 changes: 46 additions & 0 deletions python/tests/nistoar/midas/dbio/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$and":[
{
"status.state":"edit"
},
{
"name":"test3"
},
{
"$or":[
{
"acls.delete":{
"$in":[
"nist0:ava1",
"grp0:public"
]
}
},
{
"acls.write":{
"$in":[
"nist0:ava1",
"grp0:public"
]
}
},
{
"acls.admin":{
"$in":[
"nist0:ava1",
"grp0:public"
]
}
},
{
"acls.read":{
"$in":[
"nist0:ava1",
"grp0:public"
]
}
}
]
}
]
}
2 changes: 1 addition & 1 deletion python/tests/nistoar/midas/dbio/test_mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ def test_select_records(self):
def test_adv_select_records(self):

# inject some data into the database

id = "pdr0:0002"
rec = base.ProjectRecord(
base.DMP_PROJECTS, {"id": id, "name": "test 1", "deactivated": "null", "status": {
Expand Down Expand Up @@ -377,6 +376,7 @@ def test_adv_select_records(self):
self.assertEqual(recs[1].id, "pdr0:0003")

recs = list(self.cli.adv_select_records(constraint_and))
print(constraint_and)
self.assertEqual(len(recs), 1)
self.assertEqual(recs[0].id, "pdr0:0003")
recs = list(self.cli.adv_select_records(constraint_andor, base.ACLs.READ))
Expand Down

0 comments on commit 5e5b0ce

Please sign in to comment.