예제 #1
0
func TestResponse(t *testing.T) {
	client := tango.NewTestClient(t)

	resp := client.Get("/")

	if resp.StatusCode != 200 {
		t.Errorf("resp.StatusCode(%v) != 200", resp.StatusCode)
		t.FailNow()
	}

	if resp.Content != "Hello, appengine." {
		t.Errorf("resp.Content('%v') != 'Hello, appengine.'", resp.Content)
		t.FailNow()
	}
}
예제 #2
0
파일: app_test.go 프로젝트: unrolled/tango
func TestResponse(t *testing.T) {
	client := tango.NewTestClient(t)

	// You can change settings like so;
	tango.Settings.Set("db_name", "postgres")
	tango.Settings.Set("db_user", "postgres")
	tango.Settings.Set("db_password", "")

	resp := client.Get("/")

	if resp.StatusCode != 200 {
		t.Errorf("resp.StatusCode(%v) != 200", resp.StatusCode)
		t.FailNow()
	}

	if !strings.Contains(resp.Content, "Postgres clock_timestamp is") {
		t.Errorf("resp.Content('%v') does not contain 'Postgres clock_timestamp is'", resp.Content)
		t.FailNow()
	}
}