O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Verifying a successful contact form submission

The next test that we will implement will test a successful contact form submission. This test, will be closely similar to the last test, with the exception that we will fill in all the form fields and provide a properly formatted email address in the email form field.

Here are the contents of the contact_test.go source file, found in the tests folder:

package testsimport (  "io/ioutil"  "net/http"  "net/url"  "strconv"  "strings"  "testing")func TestContactForm(t *testing.T) {  testURL := testHost + "/contact"  expectedTokenString := "The contact form has been successfully     completed."  form := url.Values{}  form.Add("firstName", "Isomorphic")  form.Add("lastName", "Gopher") form.Add("email", "devnull@test.com") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required