Skip to content

Commit 4eadc6f

Browse files
download offline starter project test cases added.
Signed-off-by: Michael Valdron <[email protected]>
1 parent 3ddd742 commit 4eadc6f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/integration/pkg/tests/indexserver_tests.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,40 @@ var _ = ginkgo.Describe("[Verify index server is working properly]", func() {
318318
}))
319319
})
320320

321+
ginkgo.It("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an offline zip archive for devfile starter project", func() {
322+
resp, err := http.Get(config.Registry + "/devfiles/go/starter-projects/go-starter-offline")
323+
var bytes []byte
324+
325+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
326+
defer resp.Body.Close()
327+
328+
bytes, err = ioutil.ReadAll(resp.Body)
329+
330+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
331+
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
332+
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
333+
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
334+
return http.DetectContentType(file) == "application/zip"
335+
}))
336+
})
337+
338+
ginkgo.It("/devfiles/<devfile>/<version>/starter-projects/<starterProject> endpoint should return an offline zip archive for devfile starter project", func() {
339+
resp, err := http.Get(config.Registry + "/devfiles/go/1.2.0/starter-projects/go-starter-offline")
340+
var bytes []byte
341+
342+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
343+
defer resp.Body.Close()
344+
345+
bytes, err = ioutil.ReadAll(resp.Body)
346+
347+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
348+
gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted))
349+
gomega.Expect(bytes).ToNot(gomega.BeEmpty())
350+
gomega.Expect(bytes).To(gomega.Satisfy(func(file []byte) bool {
351+
return http.DetectContentType(file) == "application/zip"
352+
}))
353+
})
354+
321355
ginkgo.It("/devfiles/<devfile>/starter-projects/<starterProject> endpoint should return an error for a devfile that doesn't exist", func() {
322356
resp, err := http.Get(config.Registry + "/devfiles/fake-stack/starter-projects/springbootproject")
323357

0 commit comments

Comments
 (0)