|
@ -10,8 +10,10 @@ import ( |
|
|
|
|
|
|
|
|
"github.com/bxcodec/faker/v3" |
|
|
"github.com/bxcodec/faker/v3" |
|
|
"github.com/geplauder/lithium/pipelines" |
|
|
"github.com/geplauder/lithium/pipelines" |
|
|
|
|
|
"github.com/geplauder/lithium/settings" |
|
|
"github.com/geplauder/lithium/storage" |
|
|
"github.com/geplauder/lithium/storage" |
|
|
"github.com/gorilla/mux" |
|
|
"github.com/gorilla/mux" |
|
|
|
|
|
"github.com/spf13/afero" |
|
|
"github.com/stretchr/testify/assert" |
|
|
"github.com/stretchr/testify/assert" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -35,8 +37,9 @@ func TestEndpointRoute(t *testing.T) { |
|
|
t.Run("Registered pipelines are valid routes", func(t *testing.T) { |
|
|
t.Run("Registered pipelines are valid routes", func(t *testing.T) { |
|
|
router := mux.NewRouter() |
|
|
router := mux.NewRouter() |
|
|
fs := storage.GetMemoryStorageProvider() |
|
|
fs := storage.GetMemoryStorageProvider() |
|
|
|
|
|
appSettings, _ := settings.LoadSettings(afero.NewMemMapFs()) |
|
|
|
|
|
|
|
|
RegisterRoutes(router, []pipelines.IPipeline{data}, fs) |
|
|
|
|
|
|
|
|
RegisterRoutes(router, appSettings, []pipelines.IPipeline{data}, fs) |
|
|
|
|
|
|
|
|
request, _ := http.NewRequest("GET", "/pipelines/"+data.Slug, nil) |
|
|
request, _ := http.NewRequest("GET", "/pipelines/"+data.Slug, nil) |
|
|
responseRecorder := httptest.NewRecorder() |
|
|
responseRecorder := httptest.NewRecorder() |
|
@ -64,8 +67,9 @@ func TestUploadRoute(t *testing.T) { |
|
|
t.Run("Test uploads missing multipart boundary", func(t *testing.T) { |
|
|
t.Run("Test uploads missing multipart boundary", func(t *testing.T) { |
|
|
router := mux.NewRouter() |
|
|
router := mux.NewRouter() |
|
|
fs := storage.GetMemoryStorageProvider() |
|
|
fs := storage.GetMemoryStorageProvider() |
|
|
|
|
|
appSettings, _ := settings.LoadSettings(afero.NewMemMapFs()) |
|
|
|
|
|
|
|
|
RegisterRoutes(router, []pipelines.IPipeline{pipelines.Pipeline{ |
|
|
|
|
|
|
|
|
RegisterRoutes(router, appSettings, []pipelines.IPipeline{pipelines.Pipeline{ |
|
|
Name: "", |
|
|
Name: "", |
|
|
Slug: "", |
|
|
Slug: "", |
|
|
Type: 0, |
|
|
Type: 0, |
|
@ -92,8 +96,9 @@ func TestUploadRoute(t *testing.T) { |
|
|
t.Run("Test uploads missing multipart boundary", func(t *testing.T) { |
|
|
t.Run("Test uploads missing multipart boundary", func(t *testing.T) { |
|
|
router := mux.NewRouter() |
|
|
router := mux.NewRouter() |
|
|
fs := storage.GetMemoryStorageProvider() |
|
|
fs := storage.GetMemoryStorageProvider() |
|
|
|
|
|
appSettings, _ := settings.LoadSettings(afero.NewMemMapFs()) |
|
|
|
|
|
|
|
|
RegisterRoutes(router, []pipelines.IPipeline{pipelines.Pipeline{ |
|
|
|
|
|
|
|
|
RegisterRoutes(router, appSettings, []pipelines.IPipeline{pipelines.Pipeline{ |
|
|
Name: "", |
|
|
Name: "", |
|
|
Slug: "", |
|
|
Slug: "", |
|
|
Type: 0, |
|
|
Type: 0, |
|
|