Commit 2e26fd83 authored by santiaago's avatar santiaago
Browse files

add test for controller Isogrids.RandomGradient Banner #36

parent 860b4244
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ func TestBannerRandom(t *testing.T) {
	r := new(route.Router)
	r.HandleFunc("/isogrids/banner/random", BannerRandom)

	test := tgTesting.GenerateHandlerFunc(t, Hexa)
	test := tgTesting.GenerateHandlerFunc(t, BannerRandom)
	for _, p := range tgTesting.GoodParams {
		recorder := test("/isogrids/banner/random", "GET", p, r)
		if recorder.Code != http.StatusOK {
@@ -28,3 +28,24 @@ func TestBannerRandom(t *testing.T) {
		}
	}
}

func TestBannerRandomGradient(t *testing.T) {

	r := new(route.Router)
	r.HandleFunc("/isogrids/banner/random/gradient", BannerRandomGradient)

	test := tgTesting.GenerateHandlerFunc(t, BannerRandomGradient)
	for _, p := range tgTesting.GoodParams {
		recorder := test("/isogrids/banner/random/gradient", "GET", p, r)
		if recorder.Code != http.StatusOK {
			t.Errorf("returned %v. Expected %v.", recorder.Code, http.StatusOK)
		}
	}

	for _, p := range tgTesting.BadParams {
		recorder := test("/isogrids/banner/random/gradient", "GET", p, r)
		if recorder.Code != http.StatusOK {
			t.Errorf("returned %v. Expected %v.", recorder.Code, http.StatusOK)
		}
	}
}
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ func init() {
		`{"theme":"frogideas"}`,
		`{"w":"500", "h":"100"}`,
		`{"xs":"500"}`,
		`{"xt":"500"}`,
	}

	BadParams = []string{
@@ -31,6 +32,7 @@ func init() {
		`{"theme":"wrongTheme"}`,
		`{"w":"wrongW", "h":"wrongH"}`,
		`{"xs":"wrongXS"}`,
		`{"xt":"wrongXT"}`,
	}
}