def test_form_update(self): userId = "cm:testId:" + str(uuid.uuid4()) user = User(id=userId).save() paymentInfo = { "currency": "USD", "items": [{ "name": "name", "description": "description", "amount": "amountField", "quantity": "1" }] } form = Form(schema={ "type": "object", "properties": { "amountField": { "type": "number" } } }, uiSchema={"title": "Test"}, formOptions=FormOptions(paymentInfo=paymentInfo), date_created=datetime.datetime.now(), date_modified=datetime.datetime.now(), name="Name", cff_permissions={userId: { "owner": True }}) form.save() formId = form.id table = display_form_dict({"a": "b"}) self.assertEqual(table, "<table><tr><th>A</th><td>b</td></tr></table>")
def test_display_form_dict_array(self): table = display_form_dict( {"a": "b", "participants": [{"name": "name1"}, {"name": "name2"}]} ) self.assertEqual( table, "<table><tr><th>A</th><td>b</td></tr><tr><th>Participant 1 Name</th><td>name1</td></tr><tr><th>Participant 2 Name</th><td>name2</td></tr></table>", )
def test_display_form_dict_array_simple(self): table = display_form_dict({ "a": "b", "participants": ["name1", "name2"] }) self.assertEqual( table, "<table><tr><th>A</th><td>b</td></tr><tr><th>Participant 1 </th><td>name1</td></tr><tr><th>Participant 2 </th><td>name2</td></tr></table>" )
def test_display_form_dict_simple(self): table = display_form_dict({"a": "b"}) self.assertEqual(table, "<table><tr><th>A</th><td>b</td></tr></table>")
def test_display_form_dict_nested_object(self): table = display_form_dict({"a": "b", "c": {"d": "e"}}) self.assertEqual( table, "<table><tr><th>A</th><td>b</td></tr><tr><th>C: D</th><td>e</td></tr></table>", )
try: client.create_template(Template=template) print("Created template {}.".format(template["TemplateName"])) except client.exceptions.AlreadyExistsException: client.update_template(Template=template) print("Updated template {}.".format(template["TemplateName"])) print("Querying all responses...") responses = get_all_responses( KeyConditionExpression=Key("formId").eq(formId), FilterExpression=Key("PAID").eq(True), ) print("Got responses.") response = responses[0] EMAIL_CONTENT += "<h2>Your lookup ID: <strong>{}</strong></h2><br><br>{}".format( response["responseId"][:6], display_form_dict(response["value"]) ) BODY_TEXT, BODY_HTML = email_to_html_text(EMAIL_CONTENT) recipient = "*****@*****.**" response = client.send_bulk_templated_email( Source="*****@*****.**", Template="Basic", DefaultTemplateData=json.dumps( { "subject": "Om Run Final Information Email", "body_text": "Error", "body_html": "Error", } ), Destinations=[ {