def test_create_section(): # section_data = request.json_body section_data = {"sec_date_in": "1/1/2019", "sec_text": "new section 1"} sec_id = BLL_Sections.create_section(section_data) print(sec_id) return sec_id
def test_create_doc_group_relationships(): # get a random existing document docs = BLL_Documents.get_documents() y = random.randint(1, len(docs)) aDoc = docs[y] aDoc_dict = aDoc.to_dict() doc_id = aDoc_dict['doc_id'] y = random.randint(1, len(docs)) aDoc = docs[y] aDoc_dict = aDoc.to_dict() append_doc_id = aDoc_dict['doc_id'] # create a section # get random existing section sections = BLL_Sections.get_sections() u = random.randint(1, len(sections)) aSection = sections[u] aSection_dict = aSection.to_dict() sec_id = aSection_dict['sec_id'] # # create a group # group_data = {"doc_id": doc_id, # "sec_id": sec_id} # r = BLL_Groups.create_group(group_data) # group_id = r["msg"] # print("created group" + group_id) j_body = {"doc_id": doc_id, "append_doc_id": append_doc_id} r = BLL_DocGroupSections.attach_sections(j_body)
def test_edit_section(): section_data = { "sec_id": "77640590-7012-476f-9afc-16876bfd35fd", "sec_text": "new section 1a", "sec_date_in": "2019-01-01" } r = BLL_Sections.update_section("77640590-7012-476f-9afc-16876bfd35fd", section_data) print(r)
def test_create_group(inc_num): # create a document doc_data = {"doc_name": "new doc 2:22_" + inc_num} r = BLL_Documents.create_document(doc_data=doc_data) doc_id = r["msg"] print("doc_id = {}".format(doc_id)) # create a section section_data = {"sec_date_in": "1/1/2019", "sec_text": "new section 1"} r = BLL_Sections.create_section(section_data) sec_id = r["msg"] print("sec_id = {}".format(sec_id)) # create a group group_data = {"doc_id": doc_id, "sec_id": sec_id} r = BLL_Groups.create_group(group_data) group_id = r["msg"] print("created group" + group_id)
def test_get_sections_by_doc(doc_id): sections = BLL_Sections.get_sections_by_doc(doc_id) print('found {} sections'.format(len(sections))) return None
def test_get_all_sections(): sections = BLL_Sections.get_sections() print('found {} sections'.format(len(sections))) return None
def update_section(request: Request): sec_id = request.matchdict.get('sec_id') section_data = request.json_body r = BLL_Sections.update_section(sec_id, section_data) return Response(status=200, body=r)
def create_section(request: Request): j_body = request.json_body r = BLL_Sections.create_section(j_body) return Response(status=r['status'], body=r['msg'])
def single_section(request: Request): sec_id = request.matchdict.get('sec_id') section = BLL_Sections.single_section(sec_id) return section
def all_sections(_): sections = BLL_Sections.get_sections() return sections