1import ./make-test-python.nix ({pkgs, ...}: {
2 name = "your_spotify";
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [patrickdag];
5 };
6
7 nodes.machine = {
8 services.your_spotify = {
9 enable = true;
10 spotifySecretFile = pkgs.writeText "spotifySecretFile" "deadbeef";
11 settings = {
12 CLIENT_ENDPOINT = "http://localhost";
13 API_ENDPOINT = "http://localhost:3000";
14 SPOTIFY_PUBLIC = "beefdead";
15 };
16 enableLocalDB = true;
17 nginxVirtualHost = "localhost";
18 };
19 };
20
21 testScript = ''
22 machine.wait_for_unit("your_spotify.service")
23
24 machine.wait_for_open_port(3000)
25 machine.wait_for_open_port(80)
26
27 out = machine.succeed("curl --fail -X GET 'http://localhost:3000/'")
28 assert "Hello !" in out
29
30 out = machine.succeed("curl --fail -X GET 'http://localhost:80/'")
31 assert "<title>Your Spotify</title>" in out
32 '';
33})