diff options
author | Vika <vika@fireburn.ru> | 2021-07-19 04:56:08 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2021-07-19 04:57:12 +0300 |
commit | 5476bb17dc428bcef8163c26c320e5c3ef1ff5d5 (patch) | |
tree | 61f57a64379dda47d8c6a6a97e1768b3e6f4538c | |
parent | bf4f0eafe402d128a63695559134e6fe05d51a2e (diff) | |
download | kittybox-5476bb17dc428bcef8163c26c320e5c3ef1ff5d5.tar.zst |
Added a NixOS test for onboarding workflow
-rw-r--r-- | flake.nix | 29 |
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'") ''; }); }; |