about summary refs log tree commit diff
path: root/nixos/tests/magnetico.nix
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2019-11-13 19:17:32 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2019-11-16 22:14:46 +0100
commitf6a8eb2d00cd71e630484337cae29c37694037a6 (patch)
treebf9ee22b6c559f584bb52bbec3893c07d0b66643 /nixos/tests/magnetico.nix
parent6823199dbec1c14c69c65d063775599c62e77779 (diff)
nixos/tests/magnetico: port to python
Diffstat (limited to 'nixos/tests/magnetico.nix')
-rw-r--r--nixos/tests/magnetico.nix22
1 files changed, 13 insertions, 9 deletions
diff --git a/nixos/tests/magnetico.nix b/nixos/tests/magnetico.nix
index 2b1af8328da7c..6770d32358e83 100644
--- a/nixos/tests/magnetico.nix
+++ b/nixos/tests/magnetico.nix
@@ -1,4 +1,4 @@
-import ./make-test.nix ({ pkgs, ...} :
+import ./make-test-python.nix ({ pkgs, ...} :
 
 let
   port = 8081;
@@ -24,13 +24,17 @@ in
 
   testScript =
     ''
-      startAll;
-      $machine->waitForUnit("magneticod");
-      $machine->waitForUnit("magneticow");
-      $machine->succeed("${pkgs.curl}/bin/curl ".
-        "-u user:password http://localhost:${toString port}");
-      $machine->succeed("${pkgs.curl}/bin/curl ".
-        "-u user:wrongpwd http://localhost:${toString port}") =~ "Unauthorised." or die;
-      $machine->shutdown();
+      start_all()
+      machine.wait_for_unit("magneticod")
+      machine.wait_for_unit("magneticow")
+      machine.succeed(
+          "${pkgs.curl}/bin/curl "
+          + "-u user:password http://localhost:${toString port}"
+      )
+      assert "Unauthorised." in machine.succeed(
+          "${pkgs.curl}/bin/curl "
+          + "-u user:wrongpwd http://localhost:${toString port}"
+      )
+      machine.shutdown()
     '';
 })