You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/01/10 03:38:23 UTC
[11/50] incubator-trafficcontrol git commit: update Type struct to
return ID. Updated test to check for ID and UseInTable
update Type struct to return ID. Updated test to check for ID and UseInTable
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e769ef19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e769ef19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e769ef19
Branch: refs/heads/master
Commit: e769ef198d604b9db17dd4e67d7b8d79d4d38eb0
Parents: 33d1205
Author: David Neuman <da...@gmail.com>
Authored: Wed Nov 30 10:20:38 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:04:59 2017 -0700
----------------------------------------------------------------------
traffic_ops/client/fixtures/types.go | 2 ++
traffic_ops/client/tests/type_test.go | 12 ++++++++++++
traffic_ops/client/type.go | 1 +
3 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e769ef19/traffic_ops/client/fixtures/types.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/fixtures/types.go b/traffic_ops/client/fixtures/types.go
index 9f74c59..ef77346 100644
--- a/traffic_ops/client/fixtures/types.go
+++ b/traffic_ops/client/fixtures/types.go
@@ -22,8 +22,10 @@ func Types() *client.TypeResponse {
return &client.TypeResponse{
Response: []client.Type{
client.Type{
+ ID: 1,
Name: "EDGE",
Description: "edge cache",
+ UseInTable: "server",
},
},
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e769ef19/traffic_ops/client/tests/type_test.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/tests/type_test.go b/traffic_ops/client/tests/type_test.go
index e4d8a43..a0edd41 100644
--- a/traffic_ops/client/tests/type_test.go
+++ b/traffic_ops/client/tests/type_test.go
@@ -45,6 +45,12 @@ func TestTypes(t *testing.T) {
}
for _, n := range types {
+ if n.ID != 1 {
+ testHelper.Error(t, "Should get back 1 for \"ID\", got %d", n.ID)
+ } else {
+ testHelper.Success(t, "Should get back 1 for \"ID\"")
+ }
+
if n.Name != "EDGE" {
testHelper.Error(t, "Should get back \"EDGE\" for \"Name\", got %s", n.Name)
} else {
@@ -56,6 +62,12 @@ func TestTypes(t *testing.T) {
} else {
testHelper.Success(t, "Should get back \"edge cache\" for \"Description\"")
}
+
+ if n.UseInTable != "server" {
+ testHelper.Error(t, "Should get back \"server\" for \"UseInTable\", got %s", n.UseInTable)
+ } else {
+ testHelper.Success(t, "Should get back \"server\" for \"UseInTable\"")
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e769ef19/traffic_ops/client/type.go
----------------------------------------------------------------------
diff --git a/traffic_ops/client/type.go b/traffic_ops/client/type.go
index 96316f3..688c11d 100644
--- a/traffic_ops/client/type.go
+++ b/traffic_ops/client/type.go
@@ -27,6 +27,7 @@ type TypeResponse struct {
// Type contains information about a given Type in Traffic Ops.
type Type struct {
+ ID int `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
UseInTable string `json:"useInTable,omitempt"`