Skip to content

Commit

Permalink
Serve and read from local server for url test. (argoproj#77)
Browse files Browse the repository at this point in the history
Instead of reading a Github url, this commit starts and local http server and makes
the URLReader read from that server.

Closes argoproj#70.
  • Loading branch information
shrinandj authored and magaldima committed Jul 28, 2018
1 parent 355a5d4 commit ff688f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion store/url_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
package store

import (
"fmt"
"testing"

"net/http"
"net/http/httptest"

"github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1"
"github.com/stretchr/testify/assert"
)

func TestURLReader(t *testing.T) {
urlArtifact := v1alpha1.URLArtifact{Path: "https://raw.githubusercontent.com/argoproj/argo/master/examples/hello-world.yaml"}
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello, client")
}))
defer ts.Close()

urlArtifact := v1alpha1.URLArtifact{Path: ts.URL}
assert.False(t, urlArtifact.VerifyCert)
urlReader, err := NewURLReader(&urlArtifact)
assert.NotNil(t, urlReader)
Expand Down

0 comments on commit ff688f0

Please sign in to comment.