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/08/30 20:38:35 UTC
[GitHub] rob05c closed pull request #2782: TO GO: Added missing struct
fields to satisfy v11 definition of a user
rob05c closed pull request #2782: TO GO: Added missing struct fields to satisfy v11 definition of a user
URL: https://github.com/apache/trafficcontrol/pull/2782
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/lib/go-tc/users.go b/lib/go-tc/users.go
index 7c4e8ce56..5bb740f2c 100644
--- a/lib/go-tc/users.go
+++ b/lib/go-tc/users.go
@@ -30,18 +30,28 @@ type UsersResponse struct {
// User contains information about a given user in Traffic Ops.
type User struct {
- Username string `json:"username,omitempty"`
- PublicSSHKey string `json:"publicSshKey,omitempty"`
- Role int `json:"role,omitempty"`
- RoleName string `json:"rolename,omitempty"`
- ID int `json:"id,omitempty"`
- UID int `json:"uid,omitempty"`
- GID int `json:"gid,omitempty"`
- Company string `json:"company,omitempty"`
- Email string `json:"email,omitempty"`
- FullName string `json:"fullName,omitempty"`
- NewUser bool `json:"newUser,omitempty"`
- LastUpdated string `json:"lastUpdated,omitempty"`
+ Username string `json:"username,omitempty"`
+ PublicSSHKey string `json:"publicSshKey,omitempty"`
+ Role int `json:"role,omitempty"`
+ RoleName string `json:"rolename,omitempty"`
+ ID int `json:"id,omitempty"`
+ UID int `json:"uid,omitempty"`
+ GID int `json:"gid,omitempty"`
+ Company string `json:"company,omitempty"`
+ Email string `json:"email,omitempty"`
+ FullName string `json:"fullName,omitempty"`
+ NewUser bool `json:"newUser,omitempty"`
+ LastUpdated string `json:"lastUpdated,omitempty"`
+ AddressLine1 string `json:"addressLine1"`
+ AddressLine2 string `json:"addressLine2"`
+ City string `json:"city"`
+ Country string `json:"country"`
+ PhoneNumber string `json:"phoneNumber"`
+ PostalCode string `json:"postalCode"`
+ RegistrationSent time.Time `json:"registrationSent"`
+ StateOrProvince string `json:"stateOrProvince"`
+ Tenant string `json:"tenant"`
+ TenantID int `json:"tenantId"`
}
// Credentials contains Traffic Ops login credentials
diff --git a/traffic_ops/testing/api/v13/user_test.go b/traffic_ops/testing/api/v13/user_test.go
index abe8bbf76..7485b4182 100644
--- a/traffic_ops/testing/api/v13/user_test.go
+++ b/traffic_ops/testing/api/v13/user_test.go
@@ -15,9 +15,9 @@ package v13
*/
import (
- "testing"
-
+ "encoding/json"
"github.com/apache/trafficcontrol/lib/go-log"
+ "testing"
)
func TestUsers(t *testing.T) {
@@ -29,13 +29,12 @@ func TestUsers(t *testing.T) {
CreateTestRegions(t)
CreateTestPhysLocations(t)
CreateTestCacheGroups(t)
- CreateTestServers(t)
CreateTestDeliveryServices(t)
+ GetTestUsers(t)
GetTestUserCurrent(t)
DeleteTestDeliveryServices(t)
- DeleteTestServers(t)
DeleteTestCacheGroups(t)
DeleteTestPhysLocations(t)
DeleteTestRegions(t)
@@ -49,6 +48,23 @@ func TestUsers(t *testing.T) {
const SessionUserName = "admin" // TODO make dynamic?
+func GetTestUsers(t *testing.T) {
+
+ resp, _, err := TOSession.GetUsers()
+ if err != nil {
+ t.Fatalf("cannot GET users: %v\n", err)
+ }
+ if len(resp) == 0 {
+ t.Fatalf("no users, must have at least 1 user to test\n")
+ }
+
+ log.Debugf("Response: %s\n")
+ for _, user := range resp {
+ bytes, _ := json.Marshal(user)
+ log.Debugf("%s\n", bytes)
+ }
+}
+
func GetTestUserCurrent(t *testing.T) {
log.Debugln("GetTestUserCurrent")
user, _, err := TOSession.GetUserCurrent()
diff --git a/traffic_ops/testing/api/v13/userdeliveryservices_test.go b/traffic_ops/testing/api/v13/userdeliveryservices_test.go
index e6acf4f6a..2b07f87a6 100644
--- a/traffic_ops/testing/api/v13/userdeliveryservices_test.go
+++ b/traffic_ops/testing/api/v13/userdeliveryservices_test.go
@@ -29,7 +29,6 @@ func TestUsersDeliveryServices(t *testing.T) {
CreateTestRegions(t)
CreateTestPhysLocations(t)
CreateTestCacheGroups(t)
- CreateTestServers(t)
CreateTestDeliveryServices(t)
CreateTestUsersDeliveryServices(t)
@@ -37,7 +36,6 @@ func TestUsersDeliveryServices(t *testing.T) {
DeleteTestUsersDeliveryServices(t)
DeleteTestDeliveryServices(t)
- DeleteTestServers(t)
DeleteTestCacheGroups(t)
DeleteTestPhysLocations(t)
DeleteTestRegions(t)
----------------------------------------------------------------
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