def testRequiredFields(self): required = Study.required_fields() self.assertEqual(type(required), tuple, "required_fields() returns a tuple.") self.assertTrue(len(required) > 0, "required_field() did not return empty value.")
def testRequiredFields(self): required = Study.required_fields() self.assertEqual(type(required), tuple, "required_fields() returns a tuple.") self.assertTrue( len(required) > 0, "required_field() did not return empty value.")
root = logging.getLogger() root.setLevel(logging.DEBUG) ch = logging.StreamHandler(sys.stdout) ch.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) root.addHandler(ch) set_logging() session = iHMPSession(username, password) print("Required fields:") print(Study.required_fields()) test_study = Study() test_study.name = "Test name" test_study.description = "Test description" test_study.center = "Stanford University" test_study.contact = "Test contact" test_study.srp_id = "Test SRP ID" test_study.tags = ["study", "ihmp"] test_study.add_tag("another") test_study.add_tag("and_another") test_study.links = {"part_of": ["610a4911a5ca67de12cdc1e4b40018e1"]} print(test_study.to_json(indent=2))
#!/usr/bin/env python import json import logging from cutlass import Study from cutlass import iHMPSession from pprint import pprint username = "******" password = "******" session = iHMPSession(username, password) print("Required fields:") print(Study.required_fields()) test_study = Study() test_study.name = "Test name" test_study.description = "Test description" test_study.center = "Stanford University" test_study.contact = "Test contact" test_study.srp_id = "Test SRP ID" test_study.tags = [ "study", "ihmp" ] test_study.add_tag("another") test_study.add_tag("and_another") test_study.links = { "part_of": [ "610a4911a5ca67de12cdc1e4b40018e1" ] } print(test_study.to_json(indent=2))