Add support for notification dry run feature
- Introduced NOTIFICATION_DRY_RUN configuration option in .env.example and k8s/secret.example.yaml. - Updated README.md to include usage instructions for the new dry run feature. - Implemented logic in app.go to preview notifications without sending them when the dry run option is enabled. - Enhanced config.go to load the new configuration option and validate notification types accordingly. - Added a new function in notify.go to generate manual-needed notification messages for preview.
This commit is contained in:
31
internal/qbit/client_test.go
Normal file
31
internal/qbit/client_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package qbit
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"ncore-hnr/internal/model"
|
||||
)
|
||||
|
||||
func TestMatchByNameMatchesLongerReleaseName(t *testing.T) {
|
||||
torrents := []model.QBitTorrent{
|
||||
{Name: "The.Black.Dagger.Brotherhood.S01E01.720p.WEB.h264-GROUP", Hash: "match"},
|
||||
}
|
||||
|
||||
match, ok := MatchByName("The Black Dagger Brotherhood S01E01 720p", torrents)
|
||||
if !ok {
|
||||
t.Fatal("expected qBittorrent release name to match nCore display name")
|
||||
}
|
||||
if match.Hash != "match" {
|
||||
t.Fatalf("expected match hash %q, got %q", "match", match.Hash)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMatchByNameDoesNotMatchDifferentEpisode(t *testing.T) {
|
||||
torrents := []model.QBitTorrent{
|
||||
{Name: "The.Black.Dagger.Brotherhood.S01E02.720p.WEB.h264-GROUP", Hash: "wrong"},
|
||||
}
|
||||
|
||||
if _, ok := MatchByName("The Black Dagger Brotherhood S01E01 720p", torrents); ok {
|
||||
t.Fatal("expected different episode not to match")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user