// postProduct401 validates a product can't be created with the endpoint
// unless the user is authenticated
postProduct401 validates a product can't be created with the endpoint
unless the user is authenticated
// postProduct401 validates a product can ' t be created with the endpoint // unless the user is authenticated
func postProduct401(t *testing.T) {
	np := product.NewProduct{
		Name:      "Comic Books",
		Notes:     "Various conditions.",
		Family:    "Kennedy",
		UnitPrice: 25,
		Quantity:  60,
	}
	body, err := json.Marshal(&np)
	if err != nil {
		t.Fatal(err)
	}
	r := httptest.NewRequest("POST", "/v1/products", bytes.NewBuffer(body))
	w := httptest.NewRecorder()
	a.ServeHTTP(w, r)
	t.Log("Given the need to validate a new product can't be created with an invalid document.")
	{
		t.Log("\tTest 0:\tWhen using an incomplete product value.")
		{
			if w.Code != http.StatusUnauthorized {
				t.Fatalf("\t%s\tShould receive a status code of 401 for the response : %v", tests.Failed, w.Code)
			}
			t.Logf("\t%s\tShould receive a status code of 401 for the response.", tests.Success)
		}
	}
}
func postProduct401 ( t * testing . T ) { np := product . NewProduct { Name : " " , Notes : " " , Family : " " , UnitPrice : 25 , Quantity : 60 , } body , err := json . Marshal ( & np ) if err != nil { t . Fatal ( err ) } r := httptest . NewRequest ( " " , " " , bytes . NewBuffer ( body ) ) w := httptest . NewRecorder ( ) a . ServeHTTP ( w , r ) t . Log ( " " ) { t . Log ( " \t \t " ) { if w . Code != http . StatusUnauthorized { t . Fatalf ( " \t \t " , tests . Failed , w . Code ) } t . Logf ( " \t \t " , tests . Success ) } } }
postProduct401 validates a product can't be created with the endpoint
unless the user is authenticated
postProduct401 validates a product can ' t be created with the endpoint unless the user is authenticated
// Not setting an authorization header