Repository: SuffolkLITLab/docassemble-ALDashboard (language: python)

Issue:
Add a way to test email configuration

Make a page to test some common API-integrated services
Also see #9 


Discussion / hints:

Fix patch:
diff --git a/docassemble/ALDashboard/data/questions/menu.yml b/docassemble/ALDashboard/data/questions/menu.yml
index 085aa06..43bb4d2 100644
--- a/docassemble/ALDashboard/data/questions/menu.yml
+++ b/docassemble/ALDashboard/data/questions/menu.yml
@@ -33,8 +33,10 @@ buttons:
     image: chart-bar
   - Install assembly line: ${ interview_url(i=user_info().package + ":install_assembly_line.yml", reset=1) }
     image: tasks
+  - Verify API keys: ${ interview_url(i=user_info().package + ":api_test.yml", reset=1) }
+    image: terminal
   - Install packages: ${ interview_url(i=user_info().package + ":install_packages.yml", reset=1) }
-    image: cogs    
+    image: cogs
   - Update packages: ${ interview_url(i=user_info().package + ":update_packages.yml", reset=1) }
     image: sync
   - Package scanner: ${ interview_url(i=user_info().package + ":package_scanner.yml", reset=1) }


Test patch:
diff --git a/docassemble/ALDashboard/data/questions/api_test.yml b/docassemble/ALDashboard/data/questions/api_test.yml
new file mode 100644
index 0000000..7c9577d
--- /dev/null
+++ b/docassemble/ALDashboard/data/questions/api_test.yml
@@ -0,0 +1,79 @@
+---
+include:
+  - docassemble.ALToolbox:display_template.yml
+  - nav.yml
+---
+metadata:
+  title: Test API keys
+  sessions are unique: True
+  required privileges:
+    - admin
+    - developer
+  temporary session: True
+---
+objects:
+  - my_person: Individual
+---
+mandatory: True
+code: |
+  address_to_complete
+  if my_person.address.address:
+    my_person.address.geocode()
+  if my_person.email:
+    email_success = send_email(to=my_person, subject="Test message from Docassemble", body="Test message body. Thanks for testing with ALDashboard.")
+  api_results  
+---
+question: |
+  Test an API key
+fields:
+  - note: |
+      ---
+      Google Maps
+
+      Server API key: `${ get_config("google", {}).get("api key") }` [BR]
+      HTTP/S API key: `${ get_config("google", {}).get("google maps api key") }`
+  - Address auto complete: address_to_complete
+    address autocomplete: True
+    required: False
+  - "Address geocoding (enter at least a street address to trigger)": my_person.address.address
+    required: False
+  - Unit: my_person.address.unit
+    required: False
+  - City: my_person.address.city
+    required: False
+  - State: my_person.address.state
+    required: False
+  - Zip: my_person.address.zip
+    required: False
+  - County: my_person.address.county
+    required: False
+  - note: |
+      ---
+      Email sending
+
+      ```
+      ${ get_config("mail") }
+      ```
+  - Enter an email to get a test message: my_person.email
+    datatype: email
+    required: False
+---
+event: api_results
+question: |
+  Results
+subquestion: |
+  % if my_person.address.address:
+  Geocoded: ${ my_person.address.was_geocoded_successfully() } [BR]
+  % if my_person.address.was_geocoded_successfully():
+  Long address: ${ my_person.address.norm_long.on_one_line() } [BR]
+  % endif
+  % if hasattr(my_person.address, "county"):
+  County: ${ my_person.address.county }
+  % endif
+  % endif
+
+  % if my_person.email:
+  Email success: ${ email_success }
+  % endif
+
+  Use the back button to try again