mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #250843 from RaitoBezarius/listmonk
This commit is contained in:
commit
4fb9aeae23
4 changed files with 29 additions and 15 deletions
|
@ -434,7 +434,7 @@ in {
|
||||||
lightdm = handleTest ./lightdm.nix {};
|
lightdm = handleTest ./lightdm.nix {};
|
||||||
lighttpd = handleTest ./lighttpd.nix {};
|
lighttpd = handleTest ./lighttpd.nix {};
|
||||||
limesurvey = handleTest ./limesurvey.nix {};
|
limesurvey = handleTest ./limesurvey.nix {};
|
||||||
listmonk = handleTest ./listmonk.nix {};
|
listmonk = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./listmonk.nix {};
|
||||||
litestream = handleTest ./litestream.nix {};
|
litestream = handleTest ./litestream.nix {};
|
||||||
lldap = handleTest ./lldap.nix {};
|
lldap = handleTest ./lldap.nix {};
|
||||||
locate = handleTest ./locate.nix {};
|
locate = handleTest ./locate.nix {};
|
||||||
|
|
|
@ -42,20 +42,27 @@ import ./make-test-python.nix ({ lib, ... }: {
|
||||||
machine.wait_for_open_port(9000)
|
machine.wait_for_open_port(9000)
|
||||||
machine.succeed("[[ -f /var/lib/listmonk/.db_settings_initialized ]]")
|
machine.succeed("[[ -f /var/lib/listmonk/.db_settings_initialized ]]")
|
||||||
|
|
||||||
|
assert json.loads(machine.succeed(generate_listmonk_request("GET", 'health')))['data'], 'Health endpoint returned unexpected value'
|
||||||
|
|
||||||
|
# A sample subscriber is guaranteed to exist at install-time
|
||||||
|
# A sample transactional template is guaranteed to exist at install-time
|
||||||
|
subscribers = json.loads(machine.succeed(generate_listmonk_request('GET', "subscribers")))['data']['results']
|
||||||
|
templates = json.loads(machine.succeed(generate_listmonk_request('GET', "templates")))['data']
|
||||||
|
tx_template = templates[2]
|
||||||
|
|
||||||
# Test transactional endpoint
|
# Test transactional endpoint
|
||||||
# subscriber_id=1 is guaranteed to exist at install-time
|
print(machine.succeed(
|
||||||
# template_id=2 is guaranteed to exist at install-time and is a transactional template (1 is a campaign template).
|
generate_listmonk_request('POST', 'tx', data={'subscriber_id': subscribers[0]['id'], 'template_id': tx_template['id']})
|
||||||
machine.succeed(
|
))
|
||||||
generate_listmonk_request('POST', 'tx', data={'subscriber_id': 1, 'template_id': 2})
|
|
||||||
)
|
assert 'Welcome Anon Doe' in machine.succeed(
|
||||||
assert 'Welcome John Doe' in machine.succeed(
|
|
||||||
"curl --fail http://localhost:8025/api/v2/messages"
|
"curl --fail http://localhost:8025/api/v2/messages"
|
||||||
)
|
), "Failed to find Welcome John Doe inside the messages API endpoint"
|
||||||
|
|
||||||
# Test campaign endpoint
|
# Test campaign endpoint
|
||||||
# Based on https://github.com/knadh/listmonk/blob/174a48f252a146d7e69dab42724e3329dbe25ebe/cmd/campaigns.go#L549 as docs do not exist.
|
# Based on https://github.com/knadh/listmonk/blob/174a48f252a146d7e69dab42724e3329dbe25ebe/cmd/campaigns.go#L549 as docs do not exist.
|
||||||
campaign_data = json.loads(machine.succeed(
|
campaign_data = json.loads(machine.succeed(
|
||||||
generate_listmonk_request('POST', 'campaigns/1/test', data={'template_id': 1, 'subscribers': ['john@example.com'], 'name': 'Test', 'subject': 'NixOS is great', 'lists': [1], 'messenger': 'email'})
|
generate_listmonk_request('POST', 'campaigns/1/test', data={'template_id': templates[0]['id'], 'subscribers': ['john@example.com'], 'name': 'Test', 'subject': 'NixOS is great', 'lists': [1], 'messenger': 'email'})
|
||||||
))
|
))
|
||||||
|
|
||||||
assert campaign_data['data'] # This is a boolean asserting if the test was successful or not: https://github.com/knadh/listmonk/blob/174a48f252a146d7e69dab42724e3329dbe25ebe/cmd/campaigns.go#L626
|
assert campaign_data['data'] # This is a boolean asserting if the test was successful or not: https://github.com/knadh/listmonk/blob/174a48f252a146d7e69dab42724e3329dbe25ebe/cmd/campaigns.go#L626
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
{ lib, buildGoModule, fetchFromGitHub, callPackage, stuffbin, nixosTests }:
|
{ lib, buildGoModule, fetchFromGitHub, callPackage, stuffbin, nixosTests, fetchpatch }:
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "listmonk";
|
pname = "listmonk";
|
||||||
version = "2.2.0";
|
version = "2.5.1";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "knadh";
|
owner = "knadh";
|
||||||
repo = "listmonk";
|
repo = "listmonk";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-dtIM0dkr8y+GbyCqrBlR5VRq6qMiZdmQyFvIoVY1eUg=";
|
sha256 = "sha256-gCnIblc83CmG1auvYYxqW/xBl6Oy1KHGkqSY/3yIm3I=";
|
||||||
};
|
};
|
||||||
|
|
||||||
vendorSha256 = "sha256-qeBuDM3REUxgu3ty02d7qsULH04USE0JUvBrtVnW8vg=";
|
patches = [
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/knadh/listmonk/pull/1479.patch";
|
||||||
|
hash = "sha256-SYACM8r+NgeSWn9VJV4+wkm+6s/MhNGwn5zyc2tw7FU=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
vendorSha256 = "sha256-0sgC1+ueZTUCP+7JwI/OKLktfMHQq959GEk1mC0TQgE=";
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
stuffbin
|
stuffbin
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
yarn2nix-moretea.mkYarnPackage rec {
|
yarn2nix-moretea.mkYarnPackage rec {
|
||||||
pname = "listmonk-frontend";
|
pname = "listmonk-frontend";
|
||||||
version = "2.2.0";
|
version = "2.5.1";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "knadh";
|
owner = "knadh";
|
||||||
repo = "listmonk";
|
repo = "listmonk";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-dtIM0dkr8y+GbyCqrBlR5VRq6qMiZdmQyFvIoVY1eUg=";
|
sha256 = "sha256-gCnIblc83CmG1auvYYxqW/xBl6Oy1KHGkqSY/3yIm3I=";
|
||||||
};
|
};
|
||||||
|
|
||||||
packageJSON = ./package.json;
|
packageJSON = ./package.json;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue