From 04b40635859e2f19546a574c87118c2c8a983d23 Mon Sep 17 00:00:00 2001 From: John Readey Date: Wed, 4 Sep 2024 04:53:41 -0500 Subject: [PATCH] added code of contact --- CODE_OF_CONDUCT.md | 2 +- hsds/domain_dn.py | 2 ++ hsds/domain_sn.py | 10 +++++++ testall.py | 2 +- tests/integ/domain_test.py | 60 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 2 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b3aa7ab0..237101de 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -5,7 +5,7 @@ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, +identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation. diff --git a/hsds/domain_dn.py b/hsds/domain_dn.py index 0e74404f..1158d333 100755 --- a/hsds/domain_dn.py +++ b/hsds/domain_dn.py @@ -134,6 +134,8 @@ async def PUT_Domain(request): now = getNow(app) domain_json["created"] = now domain_json["lastModified"] = now + #if "class" in body_json: + # domain_json["class"] = body_json["class"] # write the domain json to S3 immediately so it will show up in a get # domains S3 scan diff --git a/hsds/domain_sn.py b/hsds/domain_sn.py index 72435097..781e2537 100755 --- a/hsds/domain_sn.py +++ b/hsds/domain_sn.py @@ -553,6 +553,10 @@ async def GET_Domain(request): if domain_objs: rsp_json["domain_objs"] = domain_objs + # include domain class if present + #if "class" in domain_json: + # rsp_json["class"] = domain_json["class"] + # include dn_ids if requested if "getdnids" in params and params["getdnids"]: rsp_json["dn_ids"] = app["dn_ids"] @@ -897,12 +901,15 @@ async def PUT_Domain(request): linked_domain = None linked_bucket = None root_id = None + #domain_class = None if body and "folder" in body: if body["folder"]: is_folder = True if body and "owner" in body: owner = body["owner"] + #if body and "class" in body: + # domain_class = body["class"] if body and "linked_domain" in body: if is_folder: msg = "Folder domains can not be used for links" @@ -1042,6 +1049,9 @@ async def PUT_Domain(request): if root_id: body["root"] = root_id + #if domain_class: + # body["class"] = domain_class + log.debug(f"creating domain: {domain} with body: {body}") domain_json = await http_put(app, req, data=body) diff --git a/testall.py b/testall.py index 6ad4d3f9..95c33f8c 100755 --- a/testall.py +++ b/testall.py @@ -21,7 +21,7 @@ integ_tests = ('uptest', 'setup_test', 'domain_test', 'group_test', 'link_test', 'attr_test', 'datatype_test', 'dataset_test', - 'acl_test', 'value_test', 'filter_test', + 'acl_test', 'value_test', #'filter_test', 'pointsel_test', 'query_test', 'vlen_test') skip_unit = False diff --git a/tests/integ/domain_test.py b/tests/integ/domain_test.py index e513b741..431bdb63 100755 --- a/tests/integ/domain_test.py +++ b/tests/integ/domain_test.py @@ -489,6 +489,66 @@ def testCreateDomain(self): self.assertTrue(k in rspJson) # we should get the same value for root id self.assertEqual(root_id, rspJson["root"]) + """ + def testCreateDomainWithCustomClass(self): + domain = self.base_domain + "/newclassdomain.h6" + print("testCreateDomainWithCustomClass", domain) + headers = helper.getRequestHeaders(domain=domain) + req = helper.getEndpoint() + "/" + body = {"class": "foobar"} + rsp = self.session.put(req, data=json.dumps(body), headers=headers) + self.assertEqual(rsp.status_code, 201) + rspJson = json.loads(rsp.text) + + for k in ( + "root", + "owner", + "acls", + "created", + "lastModified", + "version", + "limits", + "compressors", + "class" + ): + self.assertTrue(k in rspJson) + + self.assertEqual(rspJson["class"], "foobar") + + root_id = rspJson["root"] + + # verify that putting the same domain again fails with a 409 error + rsp = self.session.put(req, headers=headers) + self.assertEqual(rsp.status_code, 409) + + limit_keys = ("min_chunk_size", "max_chunk_size", "max_request_size") + limits = rspJson["limits"] + for k in limit_keys: + self.assertTrue(k in limits) + limit = limits[k] + self.assertTrue(isinstance(limit, int)) + self.assertTrue(limit > 0) + compressors = rspJson["compressors"] + for compressor in EXPECTED_COMPRESSORS: + self.assertTrue(compressor in compressors) + + # do a get on the new domain + rsp = self.session.get(req, headers=headers) + self.assertEqual(rsp.status_code, 200) + rspJson = json.loads(rsp.text) + for k in ( + "root", + "owner", + "class", + "created", + "lastModified", + "limits", + "version", + ): + self.assertTrue(k in rspJson) + # we should get the same value for root id + self.assertEqual(root_id, rspJson["root"]) + """ def testCreateDomainNodeIds(self): domain = self.base_domain + "/newdomain.h7"