Skip to content

Commit

Permalink
embed test data
Browse files Browse the repository at this point in the history
Signed-off-by: CI <michael@crenshaw.dev>
  • Loading branch information
crenshaw-dev committed Aug 17, 2022
1 parent d2be252 commit 0000763
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 2 additions & 4 deletions applicationset/services/scm_provider/gitea_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"io"
"net/http"
"net/http/httptest"
"os"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/argoproj/argo-cd/v2/applicationset/services/scm_provider/testdata"
"github.com/argoproj/argo-cd/v2/pkg/apis/applicationset/v1alpha1"
)

Expand Down Expand Up @@ -244,9 +244,7 @@ func giteaMockHandler(t *testing.T) func(http.ResponseWriter, *http.Request) {
`)
require.NoError(t, err)
case "/api/v1/repos/gitea/go-sdk/contents/gitea?ref=master":
response, err := os.ReadFile("testdata/repos_gitea_go-sdk_contents_gitea.json")
require.NoError(t, err)
_, err = io.WriteString(w, string(response))
_, err := io.WriteString(w, testdata.ReposGiteaGoSdkContentsGiteaResponse)
require.NoError(t, err)
case "/api/v1/repos/gitea/go-sdk/contents/notathing?ref=master":
w.WriteHeader(404)
Expand Down
6 changes: 6 additions & 0 deletions applicationset/services/scm_provider/testdata/data.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package testdata

import _ "embed"

//go:embed repos_gitea_go-sdk_contents_gitea.json
var ReposGiteaGoSdkContentsGiteaResponse string

0 comments on commit 0000763

Please sign in to comment.