Merge lp:~jtv/gwacl/newteststoragecontext-endpoint into lp:gwacl

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: 216
Merged at revision: 216
Proposed branch: lp:~jtv/gwacl/newteststoragecontext-endpoint
Merge into: lp:gwacl
Diff against target: 55 lines (+13/-4)
2 files modified
testing.go (+1/-0)
testing_test.go (+12/-4)
To merge this branch: bzr merge lp:~jtv/gwacl/newteststoragecontext-endpoint
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+178889@code.launchpad.net

Commit message

Set AzureEndpoint in NewTestStorageContext.

Description of the change

This makes life a bit easier for third-party tests, because that endpoint is now required. This way, tests that didn't set the endpoint have a fighting chance. (The actual URL may not be what they were used to, but that variability is more or less inevitable now that we support both of the real-world Azure's endpoints).

Jeroen

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'testing.go'
--- testing.go 2013-07-08 10:03:48 +0000
+++ testing.go 2013-08-07 06:45:37 +0000
@@ -14,6 +14,7 @@
14func NewTestStorageContext(client *http.Client) *StorageContext {14func NewTestStorageContext(client *http.Client) *StorageContext {
15 storageContext := &StorageContext{}15 storageContext := &StorageContext{}
16 storageContext.client = client16 storageContext.client = client
17 storageContext.AzureEndpoint = "http://127.0.0.1/"
17 return storageContext18 return storageContext
18}19}
1920
2021
=== modified file 'testing_test.go'
--- testing_test.go 2013-08-06 11:11:50 +0000
+++ testing_test.go 2013-08-07 06:45:37 +0000
@@ -13,19 +13,27 @@
1313
14var _ = Suite(&testTesting{})14var _ = Suite(&testTesting{})
1515
16func (suite *testTesting) TestNewTestStorageContext(c *C) {16func (*testTesting) TestNewTestStorageContextCreatesCompleteContext(c *C) {
17 client := &http.Client{Transport: &TestTransport{}}
18 context := NewTestStorageContext(client)
19 context.Account = "myaccount"
20
21 c.Check(context.Account, Equals, "myaccount")
22 c.Check(context.getAccountURL(), Matches, ".*myaccount.*")
23}
24
25func (*testTesting) TestNewTestStorageContextWorksWithTransport(c *C) {
17 errorMessage := "canned-error"26 errorMessage := "canned-error"
18 error := fmt.Errorf(errorMessage)27 error := fmt.Errorf(errorMessage)
19 transport := &TestTransport{Error: error}28 transport := &TestTransport{Error: error}
20 client := &http.Client{Transport: transport}29 client := &http.Client{Transport: transport}
21 context := NewTestStorageContext(client)30 context := NewTestStorageContext(client)
22 context.AzureEndpoint = "http://example.com/"
23 request := &ListContainersRequest{Marker: ""}31 request := &ListContainersRequest{Marker: ""}
24 _, err := context.ListContainers(request)32 _, err := context.ListContainers(request)
25 c.Check(err, ErrorMatches, ".*"+errorMessage+".*")33 c.Check(err, ErrorMatches, ".*"+errorMessage+".*")
26}34}
2735
28func (suite *testTesting) TestNewDispatcherResponse(c *C) {36func (*testTesting) TestNewDispatcherResponse(c *C) {
29 body := []byte("test body")37 body := []byte("test body")
30 statusCode := http.StatusOK38 statusCode := http.StatusOK
31 errorObject := fmt.Errorf("canned-error")39 errorObject := fmt.Errorf("canned-error")
@@ -35,7 +43,7 @@
35 c.Check(dispatcherResponse.response.StatusCode, Equals, statusCode)43 c.Check(dispatcherResponse.response.StatusCode, Equals, statusCode)
36}44}
3745
38func (suite *testTesting) TestPatchManagementAPIResponses(c *C) {46func (*testTesting) TestPatchManagementAPIResponses(c *C) {
39 response := NewDispatcherResponse([]byte("<Images></Images>"), http.StatusOK, nil)47 response := NewDispatcherResponse([]byte("<Images></Images>"), http.StatusOK, nil)
40 responses := []DispatcherResponse{response, response}48 responses := []DispatcherResponse{response, response}
41 requests := PatchManagementAPIResponses(responses)49 requests := PatchManagementAPIResponses(responses)

Subscribers

People subscribed via source and target branches