You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2018/06/05 16:18:19 UTC

[incubator-trafficcontrol] 01/02: Fixed api tests for Types

This is an automated email from the ASF dual-hosted git repository.

dewrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git

commit 5283848f2189401730fea8f4fd893a62dcc94c42
Author: ASchmidt <An...@comcast.com>
AuthorDate: Tue Jun 5 09:14:51 2018 -0600

    Fixed api tests for Types
---
 traffic_ops/testing/api/v13/types_test.go | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/traffic_ops/testing/api/v13/types_test.go b/traffic_ops/testing/api/v13/types_test.go
index 8d6ad92..02b379d 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]

-- 
To stop receiving notification emails like this one, please contact
dewrich@apache.org.