|
14 | 14 | import json |
15 | 15 | from os import path as pp |
16 | 16 |
|
17 | | -from h5json.objid import createObjId |
| 17 | +from h5json.objid import createObjId, getCollectionForId |
18 | 18 |
|
19 | 19 | import config |
20 | 20 | import helper |
@@ -116,33 +116,21 @@ def testGetDomain(self): |
116 | 116 | attr_count = 0 |
117 | 117 | for objid in domain_objs: |
118 | 118 | 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"]) |
123 | 131 |
|
124 | 132 | self.assertEqual(attr_count, 4) |
125 | 133 |
|
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 | | - |
146 | 134 | # passing domain via the host header is deprecated |
147 | 135 | # Previously his returned 200, now it is a 400 |
148 | 136 | del headers["X-Hdf-domain"] |
|
0 commit comments