You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/06/05 16:18:07 UTC

[GitHub] dewrich closed pull request #2371: Fixed Go API tests for Types

dewrich closed pull request #2371: Fixed Go API tests for Types 
URL: https://github.com/apache/incubator-trafficcontrol/pull/2371
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/traffic_ops/testing/api/v13/types_test.go b/traffic_ops/testing/api/v13/types_test.go
index 8d6ad928c..eae77036d 100644
--- a/traffic_ops/testing/api/v13/types_test.go
+++ b/traffic_ops/testing/api/v13/types_test.go
@@ -25,25 +25,27 @@ import (
 func TestTypes(t *testing.T) {
 
 	CreateTestTypes(t)
-	//UpdateTestTypes(t)
-	//GetTestTypes(t)
-	//DeleteTestTypes(t)
+	UpdateTestTypes(t)
+	GetTestTypes(t)
+	DeleteTestTypes(t)
 
 }
 
 func CreateTestTypes(t *testing.T) {
+	log.Debugln("---- CreateTestTypes ----")
 
 	for _, typ := range testData.Types {
 		resp, _, err := TOSession.CreateType(typ)
-		log.Debugln("Response: ", resp)
 		if err != nil {
 			t.Errorf("could not CREATE types: %v\n", err)
 		}
+		log.Debugln("Response: ", resp)
 	}
 
 }
 
 func UpdateTestTypes(t *testing.T) {
+	log.Debugln("---- UpdateTestTypes ----")
 
 	firstType := testData.Types[0]
 	// Retrieve the Type by name so we can get the id for the Update
@@ -70,24 +72,36 @@ func UpdateTestTypes(t *testing.T) {
 		t.Errorf("results do not match actual: %s, expected: %s\n", respType.Name, expectedTypeName)
 	}
 
+	log.Debugln("Response Type: ", respType)
+
+	respType.Name = firstType.Name
+	alert, _, err = TOSession.UpdateTypeByID(respType.ID, respType)
+	if err != nil {
+		t.Errorf("cannot restore UPDATE Type by id: %v - %v\n", err, alert)
+	}
 }
 
 func GetTestTypes(t *testing.T) {
+	log.Debugln("---- GetTestTypes ----")
 
 	for _, typ := range testData.Types {
 		resp, _, err := TOSession.GetTypeByName(typ.Name)
 		if err != nil {
 			t.Errorf("cannot GET Type by name: %v - %v\n", err, resp)
+
 		}
+
+		log.Debugln("Response: ", resp)
 	}
 }
 
 func DeleteTestTypes(t *testing.T) {
+	log.Debugln("---- DeleteTestTypes ----")
 
 	for _, typ := range testData.Types {
 		// Retrieve the Type by name so we can get the id for the Update
 		resp, _, err := TOSession.GetTypeByName(typ.Name)
-		if err != nil {
+		if err != nil || len(resp) == 0 {
 			t.Errorf("cannot GET Type by name: %v - %v\n", typ.Name, err)
 		}
 		respType := resp[0]


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services