Skip to content

Commit c66d632

Browse files
committed
fix for domain_test
1 parent 23bb24b commit c66d632

1 file changed

Lines changed: 13 additions & 25 deletions

File tree

tests/integ/domain_test.py

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import json
1515
from os import path as pp
1616

17-
from h5json.objid import createObjId
17+
from h5json.objid import createObjId, getCollectionForId
1818

1919
import config
2020
import helper
@@ -116,33 +116,21 @@ def testGetDomain(self):
116116
attr_count = 0
117117
for objid in domain_objs:
118118
obj_json = domain_objs[objid]
119-
self.assertTrue("id" in obj_json)
120-
self.assertTrue("attributeCount" in obj_json)
121-
attr_count += obj_json["attributeCount"]
122-
self.assertFalse("attributes" in obj_json)
119+
collection_type = getCollectionForId(objid)
120+
if collection_type == "datasets":
121+
self.assertTrue("attributes" in obj_json)
122+
self.assertTrue("type" in obj_json)
123+
self.assertTrue("shape" in obj_json)
124+
self.assertTrue("creationProperties" in obj_json)
125+
elif collection_type == "groups":
126+
self.assertTrue("attributes" in obj_json)
127+
self.assertTrue("links" in obj_json)
128+
else:
129+
self.assertTrue(False) # unexpected type
130+
attr_count += len(obj_json["attributes"])
123131

124132
self.assertEqual(attr_count, 4)
125133

126-
# get a dict of all objects in the domain including any attributes
127-
params["include_attrs"] = 1
128-
rsp = self.session.get(req, headers=headers, params=params)
129-
self.assertEqual(rsp.status_code, 200)
130-
rspJson = json.loads(rsp.text)
131-
self.assertTrue("domain_objs" in rspJson)
132-
domain_objs = rspJson["domain_objs"]
133-
self.assertEqual(len(domain_objs), 10)
134-
attr_count = 0
135-
for objid in domain_objs:
136-
obj_json = domain_objs[objid]
137-
self.assertTrue("attributeCount" in obj_json)
138-
self.assertTrue("attributes" in obj_json)
139-
attributes = obj_json["attributes"]
140-
for attr_name in attributes:
141-
# only the names "attr1" and "attr2" are used in this domain
142-
self.assertTrue(attr_name in ("attr1", "attr2"))
143-
attr_count += 1
144-
self.assertEqual(attr_count, 4)
145-
146134
# passing domain via the host header is deprecated
147135
# Previously his returned 200, now it is a 400
148136
del headers["X-Hdf-domain"]

0 commit comments

Comments
 (0)