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
1=== modified file 'testing.go'
2--- testing.go 2013-07-08 10:03:48 +0000
3+++ testing.go 2013-08-07 06:45:37 +0000
4@@ -14,6 +14,7 @@
5 func NewTestStorageContext(client *http.Client) *StorageContext {
6 storageContext := &StorageContext{}
7 storageContext.client = client
8+ storageContext.AzureEndpoint = "http://127.0.0.1/"
9 return storageContext
10 }
11
12
13=== modified file 'testing_test.go'
14--- testing_test.go 2013-08-06 11:11:50 +0000
15+++ testing_test.go 2013-08-07 06:45:37 +0000
16@@ -13,19 +13,27 @@
17
18 var _ = Suite(&testTesting{})
19
20-func (suite *testTesting) TestNewTestStorageContext(c *C) {
21+func (*testTesting) TestNewTestStorageContextCreatesCompleteContext(c *C) {
22+ client := &http.Client{Transport: &TestTransport{}}
23+ context := NewTestStorageContext(client)
24+ context.Account = "myaccount"
25+
26+ c.Check(context.Account, Equals, "myaccount")
27+ c.Check(context.getAccountURL(), Matches, ".*myaccount.*")
28+}
29+
30+func (*testTesting) TestNewTestStorageContextWorksWithTransport(c *C) {
31 errorMessage := "canned-error"
32 error := fmt.Errorf(errorMessage)
33 transport := &TestTransport{Error: error}
34 client := &http.Client{Transport: transport}
35 context := NewTestStorageContext(client)
36- context.AzureEndpoint = "http://example.com/"
37 request := &ListContainersRequest{Marker: ""}
38 _, err := context.ListContainers(request)
39 c.Check(err, ErrorMatches, ".*"+errorMessage+".*")
40 }
41
42-func (suite *testTesting) TestNewDispatcherResponse(c *C) {
43+func (*testTesting) TestNewDispatcherResponse(c *C) {
44 body := []byte("test body")
45 statusCode := http.StatusOK
46 errorObject := fmt.Errorf("canned-error")
47@@ -35,7 +43,7 @@
48 c.Check(dispatcherResponse.response.StatusCode, Equals, statusCode)
49 }
50
51-func (suite *testTesting) TestPatchManagementAPIResponses(c *C) {
52+func (*testTesting) TestPatchManagementAPIResponses(c *C) {
53 response := NewDispatcherResponse([]byte("<Images></Images>"), http.StatusOK, nil)
54 responses := []DispatcherResponse{response, response}
55 requests := PatchManagementAPIResponses(responses)

Subscribers

People subscribed via source and target branches