feat(sources): add managed RSS feeds (#41)
This commit is contained in:
30
backend/internal/api/source_feeds_ticket41_test.go
Normal file
30
backend/internal/api/source_feeds_ticket41_test.go
Normal file
@ -0,0 +1,30 @@
|
||||
package api_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/tradarr/backend/internal/api/handlers"
|
||||
|
||||
"github.com/tradarr/backend/internal/config"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTicket41RejectsNullConfigurationsBeforeDatabase(t *testing.T) {
|
||||
const secret = "ticket41-null-fixture"
|
||||
router := gin.New()
|
||||
router.Use(gin.Recovery())
|
||||
handler := handlers.New(nil, &config.Config{JWTSecret: secret}, nil, nil, nil, nil)
|
||||
router.PUT("/api/admin/sources/:id", handler.UpdateSource)
|
||||
for _, body := range []string{`null`, `{"enabled":true,"feed_urls":null}`} {
|
||||
r := httptest.NewRequest(http.MethodPut, "/api/admin/sources/fixture", bytes.NewBufferString(body))
|
||||
r.Header.Set("Content-Type", "application/json")
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
router.ServeHTTP(w, r)
|
||||
if w.Code != http.StatusBadRequest {
|
||||
t.Error("null source configuration reached repository")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user