about summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix29
1 files changed, 28 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index b05e05c..3ff32f9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -166,9 +166,36 @@
         };
 
         testScript = ''
+          import json
+
           kittybox.start()
           kittybox.wait_for_unit("default.target")
-          kittybox.succeed("curl --silent http://localhost:8080/micropub")
+          with subtest("Verify that Kittybox started correctly..."):
+              kittybox.succeed("curl --silent http://localhost:8080/micropub")
+
+          with subtest("Onboarding should correctly work..."):
+              onboarding_json = {
+                  "user": {
+                      "type": ["h-card"],
+                      "properties": {
+                          "name": ["Vika"],
+                          "pronoun": ["she/her"],
+                          "url": ["https://twitter.com/VikaNezrimaya"],
+                          "note": ["Just a simple girl. Do I even exist or am I a vestige of the past long gone?"]
+                      }
+                    },
+                    "first_post": {
+                        "type": ["h-entry"],
+                        "properties": {
+                            "content": ["Hello!"]
+                        }
+                    },
+                    "blog_name": "Test Hideout",
+                    "feeds": []
+              }
+              kittybox.succeed("echo '{}' | curl --silent http://localhost:8080/ -d@- -H 'Content-Type: application/json'".format(json.dumps(onboarding_json).replace("'", "'\''$")))
+              # Testing for a known string is the easiest way to determine that the onboarding worked
+              kittybox.succeed("curl --silent http://localhost:8080/ | grep 'vestige of the past long gone'")
         '';
       });
     };