Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2087)

Delta Between Two Patch Sets: store/lpad_test.go

Issue 5704056: store: add PublishCharmsDistro function
Left Patch Set: Created 12 years, 1 month ago
Right Patch Set: store: add PublishCharmsDistro function Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « store/lpad.go ('k') | store/store_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 package store_test 1 package store_test
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 . "launchpad.net/gocheck" 5 . "launchpad.net/gocheck"
6 "launchpad.net/juju/go/charm" 6 "launchpad.net/juju/go/charm"
7 "launchpad.net/juju/go/store" 7 "launchpad.net/juju/go/store"
8 "launchpad.net/lpad" 8 "launchpad.net/lpad"
9 ) 9 )
10 10
(...skipping 18 matching lines...) Expand all
29 `]`, 29 `]`,
30 branch.path(), branch.path(), branch.digest()) 30 branch.path(), branch.path(), branch.digest())
31 testServer.Response(200, jsonType, data) 31 testServer.Response(200, jsonType, data)
32 32
33 err := store.PublishCharmsDistro(s.store, apiBase) 33 err := store.PublishCharmsDistro(s.store, apiBase)
34 34
35 // Should have a single failure from the trunk branch that doesn't 35 // Should have a single failure from the trunk branch that doesn't
36 // exist. The redundant update with the known digest should be 36 // exist. The redundant update with the known digest should be
37 // ignored, and skip-me isn't a supported branch name so it's 37 // ignored, and skip-me isn't a supported branch name so it's
38 // ignored as well. 38 // ignored as well.
39 » c.Assert(err, HasLen, 1) 39 » c.Assert(err, ErrorMatches, `1 branch\(es\) failed to be published`)
40 » berr := err.(store.BranchErrors)[0] 40 » berr := err.(store.PublishBranchErrors)[0]
41 c.Assert(berr.URL, Equals, "file:///non-existent/~jeff/charms/precise/ba d/trunk") 41 c.Assert(berr.URL, Equals, "file:///non-existent/~jeff/charms/precise/ba d/trunk")
42 c.Assert(berr.Err, ErrorMatches, "(?s).*bzr: ERROR: Not a branch.*") 42 c.Assert(berr.Err, ErrorMatches, "(?s).*bzr: ERROR: Not a branch.*")
43 43
44 for _, url := range []string{"cs:oneiric/dummy", "cs:precise/dummy-0", " cs:~joe/oneiric/dummy-0"} { 44 for _, url := range []string{"cs:oneiric/dummy", "cs:precise/dummy-0", " cs:~joe/oneiric/dummy-0"} {
45 dummy, err := s.store.CharmInfo(charm.MustParseURL(url)) 45 dummy, err := s.store.CharmInfo(charm.MustParseURL(url))
46 c.Assert(err, IsNil) 46 c.Assert(err, IsNil)
47 c.Assert(dummy.Meta().Name, Equals, "dummy") 47 c.Assert(dummy.Meta().Name, Equals, "dummy")
48 } 48 }
49 49
50 // The known digest should have been ignored, so revision is still at 0. 50 // The known digest should have been ignored, so revision is still at 0.
51 _, err = s.store.CharmInfo(charm.MustParseURL("cs:~joe/oneiric/dummy-1") ) 51 _, err = s.store.CharmInfo(charm.MustParseURL("cs:~joe/oneiric/dummy-1") )
52 c.Assert(err, Equals, store.ErrNotFound) 52 c.Assert(err, Equals, store.ErrNotFound)
53 53
54 // bare /charms lookup 54 // bare /charms lookup
55 req := testServer.WaitRequest() 55 req := testServer.WaitRequest()
56 c.Assert(req.Method, Equals, "GET") 56 c.Assert(req.Method, Equals, "GET")
57 c.Assert(req.URL.Path, Equals, "/charms") 57 c.Assert(req.URL.Path, Equals, "/charms")
58 58
59 // tips request 59 // tips request
60 req = testServer.WaitRequest() 60 req = testServer.WaitRequest()
61 c.Assert(req.Method, Equals, "GET") 61 c.Assert(req.Method, Equals, "GET")
62 c.Assert(req.URL.Path, Equals, "/charms") 62 c.Assert(req.URL.Path, Equals, "/charms")
63 c.Assert(req.Form["ws.op"], DeepEquals, []string{"getBranchTips"}) 63 c.Assert(req.Form["ws.op"], DeepEquals, []string{"getBranchTips"})
64 c.Assert(req.Form["since"], IsNil) 64 c.Assert(req.Form["since"], IsNil)
65 65
66 // Request must be signed by juju. 66 // Request must be signed by juju.
67 c.Assert(req.Header.Get("Authorization"), Matches, `.*oauth_consumer_key ="juju".*`) 67 c.Assert(req.Header.Get("Authorization"), Matches, `.*oauth_consumer_key ="juju".*`)
68 } 68 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b