From 7de0d07dd9de5fb69d267152ac17d552da8864e4 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Sat, 23 Jan 2021 19:07:42 -0300 Subject: [PATCH] redshift/gammastep: add tests --- tests/default.nix | 1 + .../services/redshift-gammastep/default.nix | 4 +++ ...astep-basic-configuration-expected.service | 13 ++++++++++ .../gammastep-basic-configuration.nix | 26 +++++++++++++++++++ ...shift-basic-configuration-expected.service | 13 ++++++++++ .../redshift-basic-configuration.nix | 26 +++++++++++++++++++ 6 files changed, 83 insertions(+) create mode 100644 tests/modules/services/redshift-gammastep/default.nix create mode 100644 tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service create mode 100644 tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix create mode 100644 tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service create mode 100644 tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix diff --git a/tests/default.nix b/tests/default.nix index 09b03978..a2691c25 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -100,6 +100,7 @@ import nmt { ./modules/services/fluidsynth ./modules/services/kanshi ./modules/services/lieer + ./modules/services/redshift-gammastep ./modules/services/pbgopy ./modules/services/polybar ./modules/services/sxhkd diff --git a/tests/modules/services/redshift-gammastep/default.nix b/tests/modules/services/redshift-gammastep/default.nix new file mode 100644 index 00000000..78251059 --- /dev/null +++ b/tests/modules/services/redshift-gammastep/default.nix @@ -0,0 +1,4 @@ +{ + gammastep-basic-configuration = ./gammastep-basic-configuration.nix; + redshift-basic-configuration = ./redshift-basic-configuration.nix; +} diff --git a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service new file mode 100644 index 00000000..25b95b55 --- /dev/null +++ b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=graphical-session.target + +[Service] +ExecStart=@gammastep@/bin/gammastep -l 0.0:0.0 -t 5500:3700 -b 1:1 +Restart=on-failure +RestartSec=3 + +[Unit] +After=graphical-session-pre.target +Description=Gammastep colour temperature adjuster +Documentation=https://gitlab.com/chinstrap/gammastep/ +PartOf=graphical-session.target diff --git a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix new file mode 100644 index 00000000..c3baf8d9 --- /dev/null +++ b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: + +{ + config = { + services.gammastep = { + enable = true; + provider = "manual"; + latitude = "0.0"; + longitude = "0.0"; + }; + + nixpkgs.overlays = [ + (self: super: { + gammastep = pkgs.writeScriptBin "dummy-gammastep" "" // { + outPath = "@gammastep@"; + }; + }) + ]; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/gammastep.service \ + ${./gammastep-basic-configuration-expected.service} + ''; + }; +} diff --git a/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service b/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service new file mode 100644 index 00000000..13ccf550 --- /dev/null +++ b/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=graphical-session.target + +[Service] +ExecStart=@redshift@/bin/redshift -l 0.0:0.0 -t 5500:3700 -b 1:1 +Restart=on-failure +RestartSec=3 + +[Unit] +After=graphical-session-pre.target +Description=Redshift colour temperature adjuster +Documentation=http://jonls.dk/redshift/ +PartOf=graphical-session.target diff --git a/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix b/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix new file mode 100644 index 00000000..ab8a159a --- /dev/null +++ b/tests/modules/services/redshift-gammastep/redshift-basic-configuration.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: + +{ + config = { + services.redshift = { + enable = true; + provider = "manual"; + latitude = "0.0"; + longitude = "0.0"; + }; + + nixpkgs.overlays = [ + (self: super: { + redshift = pkgs.writeScriptBin "dummy-redshift" "" // { + outPath = "@redshift@"; + }; + }) + ]; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/redshift.service \ + ${./redshift-basic-configuration-expected.service} + ''; + }; +}