Skip to content

Commit ef746d0

Browse files
committed
added datatype test with no type in body
1 parent 7cfa3d6 commit ef746d0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

hsds/ctype_sn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def POST_Datatype(request):
155155
await validateUserPassword(app, username, pswd)
156156

157157
if not request.has_body:
158-
msg = "POST Datatype with no body"
158+
msg = "POST datatype with no body"
159159
log.warn(msg)
160160
raise HTTPBadRequest(reason=msg)
161161

@@ -213,7 +213,7 @@ async def POST_Datatype(request):
213213
kwargs["ignore_link"] = True
214214
kwarg_list.append(kwargs)
215215
kwargs = {"bucket": bucket, "root_id": root_id}
216-
log.debug(f"createDatatypeObjcs, items: {kwarg_list}")
216+
log.debug(f"createDatatypeObjects, items: {kwarg_list}")
217217
post_rsp = await createDatatypeObjs(app, kwarg_list, **kwargs)
218218
else:
219219
# single object create
@@ -251,7 +251,7 @@ async def POST_Datatype(request):
251251
links = parent_ids[parent_id]
252252
links[title] = {"id": obj_id}
253253
if parent_ids:
254-
log.debug(f"POST ctype multi - adding links: {parent_ids}")
254+
log.debug(f"POST datatype multi - adding links: {parent_ids}")
255255
kwargs = {"action": "put_link", "bucket": bucket}
256256
kwargs["replace"] = True
257257

tests/integ/datatype_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,14 @@ def testPostTypeWithId(self):
140140
# create a datatype id
141141
ctype_id = createObjId("datatypes", root_id=root_uuid)
142142

143+
# try creating a committed type without a type in the body
144+
req = self.endpoint + "/datatypes"
145+
data = {"id": ctype_id}
146+
rsp = self.session.post(req, data=json.dumps(data), headers=headers)
147+
self.assertEqual(rsp.status_code, 401) # bad request
148+
143149
# create a committed type obj
144150
data = {"id": ctype_id, "type": "H5T_IEEE_F32LE"}
145-
req = self.endpoint + "/datatypes"
146151
rsp = self.session.post(req, data=json.dumps(data), headers=headers)
147152
self.assertEqual(rsp.status_code, 201)
148153
rspJson = json.loads(rsp.text)

0 commit comments

Comments
 (0)