auth

Paddy 2015-01-14 Parent:c03b5eb3179e Child:e000b1c24fc0

115:fa8ee6a4507c Go to Latest

auth/oauth2_test.go

Turn AddEndpoint into AddEndpoints. Because one is a special case of many, it makes sense to be able to add multiple endpoints in a single call to the database. So we've converted the AddEndpoint method into an AddEndpoints method and updated our tests appropriately. We also filled in the errors when creating a client through the API, and moved things around to optimize for the maximum number of errors returned in a single call.

History
     1.1 --- a/oauth2_test.go	Sat Jan 10 04:16:07 2015 -0500
     1.2 +++ b/oauth2_test.go	Wed Jan 14 00:23:30 2015 -0500
     1.3 @@ -60,7 +60,7 @@
     1.4  	if err != nil {
     1.5  		t.Fatal("Can't store client:", err)
     1.6  	}
     1.7 -	err = testContext.AddEndpoint(client.ID, endpoint)
     1.8 +	err = testContext.AddEndpoints(client.ID, []Endpoint{endpoint})
     1.9  	if err != nil {
    1.10  		t.Fatal("Can't store endpoint:", err)
    1.11  	}
    1.12 @@ -287,7 +287,7 @@
    1.13  		URI:      *uri,
    1.14  		Added:    time.Now(),
    1.15  	}
    1.16 -	err = testContext.AddEndpoint(client.ID, endpoint)
    1.17 +	err = testContext.AddEndpoints(client.ID, []Endpoint{endpoint})
    1.18  	if err != nil {
    1.19  		t.Fatal("Can't store endpoint:", err)
    1.20  	}
    1.21 @@ -307,7 +307,7 @@
    1.22  		URI:      *uri,
    1.23  		Added:    time.Now(),
    1.24  	}
    1.25 -	err = testContext.AddEndpoint(client.ID, endpoint2)
    1.26 +	err = testContext.AddEndpoints(client.ID, []Endpoint{endpoint2})
    1.27  	if err != nil {
    1.28  		t.Fatal("Can't store endpoint:", err)
    1.29  	}
    1.30 @@ -367,7 +367,7 @@
    1.31  	if err != nil {
    1.32  		t.Fatal("Can't store client:", err)
    1.33  	}
    1.34 -	err = testContext.AddEndpoint(client.ID, endpoint)
    1.35 +	err = testContext.AddEndpoints(client.ID, []Endpoint{endpoint})
    1.36  	if err != nil {
    1.37  		t.Fatal("Can't store endpoint:", err)
    1.38  	}
    1.39 @@ -474,7 +474,7 @@
    1.40  	if err != nil {
    1.41  		t.Fatal("Can't store client:", err)
    1.42  	}
    1.43 -	err = testContext.AddEndpoint(client.ID, endpoint)
    1.44 +	err = testContext.AddEndpoints(client.ID, []Endpoint{endpoint})
    1.45  	if err != nil {
    1.46  		t.Fatal("Can't store endpoint:", err)
    1.47  	}