| 
															
																@@ -15,9 +15,11 @@ var ( 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	sampleUser = customersvc.Customer{ // omit id 
															 | 
															
															 | 
															
																 	sampleUser = customersvc.Customer{ // omit id 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		ID:   "58ff6b3f673686f96801707b", 
															 | 
															
															 | 
															
																 		ID:   "58ff6b3f673686f96801707b", 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		Name: "Luis", 
															 | 
															
															 | 
															
																 		Name: "Luis", 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-		Phone: customersvc.Phone{ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			Type:   customersvc.TypMobile, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			Number: "+5545991121214", 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+		Phone: []customersvc.Phone{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			customersvc.Phone{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				Type:   customersvc.TypMobile, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+				Number: "+5545991121214", 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			}, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		}, 
															 | 
															
															 | 
															
																 		}, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 ) 
															 | 
															
															 | 
															
																 ) 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -31,7 +33,7 @@ func TestGetCustomerBadID(t *testing.T) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	if err != nil { 
															 | 
															
															 | 
															
																 	if err != nil { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		t.Fatal(err) 
															 | 
															
															 | 
															
																 		t.Fatal(err) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-	FailNotEq(t, res.StatusCode, 400) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	FailNotEq(t, res.StatusCode, 404) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 func TestGetCustomer(t *testing.T) { 
															 | 
															
															 | 
															
																 func TestGetCustomer(t *testing.T) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -50,7 +52,6 @@ func TestGetCustomer(t *testing.T) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	json.NewDecoder(res.Body).Decode(&c) 
															 | 
															
															 | 
															
																 	json.NewDecoder(res.Body).Decode(&c) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	FailNotEq(t, c.Name, "Luis") 
															 | 
															
															 | 
															
																 	FailNotEq(t, c.Name, "Luis") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																- 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 func TestPostCustomer(t *testing.T) { 
															 | 
															
															 | 
															
																 func TestPostCustomer(t *testing.T) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	s := sampleapp.SampleApp{CustomerSVC: &CustomerSVCMock{}} 
															 | 
															
															 | 
															
																 	s := sampleapp.SampleApp{CustomerSVC: &CustomerSVCMock{}} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	ts := httptest.NewServer(s.Router()) 
															 | 
															
															 | 
															
																 	ts := httptest.NewServer(s.Router()) 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -65,6 +66,36 @@ func TestPostCustomer(t *testing.T) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	FailNotEq(t, res.StatusCode, 200) 
															 | 
															
															 | 
															
																 	FailNotEq(t, res.StatusCode, 200) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+func TestPostCustomerNoName(t *testing.T) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	s := sampleapp.SampleApp{CustomerSVC: &CustomerSVCMock{}} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	ts := httptest.NewServer(s.Router()) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	var bufData bytes.Buffer 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	newCustomer := sampleUser // Copy 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	newCustomer.Name = "" 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	json.NewEncoder(&bufData).Encode(newCustomer) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	res, err := http.Post(ts.URL+"/customer", "application/json", &bufData) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	FailNotEq(t, err, nil) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	FailNotEq(t, res.StatusCode, 400) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+func TestPostCustomerNoPhone(t *testing.T) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	s := sampleapp.SampleApp{CustomerSVC: &CustomerSVCMock{}} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	ts := httptest.NewServer(s.Router()) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	var bufData bytes.Buffer 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	newCustomer := sampleUser // Copy 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	newCustomer.Phone = []customersvc.Phone{} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	json.NewEncoder(&bufData).Encode(newCustomer) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	res, err := http.Post(ts.URL+"/customer", "application/json", &bufData) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	FailNotEq(t, err, nil) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	FailNotEq(t, res.StatusCode, 400) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 // CustomerSVCMock customer service mock 
															 | 
															
															 | 
															
																 // CustomerSVCMock customer service mock 
															 |