OLD | NEW |
1 // Copyright 2012, 2013 Canonical Ltd. | 1 // Copyright 2012, 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package common_test | 4 package common_test |
5 | 5 |
6 import ( | 6 import ( |
7 stderrors "errors" | 7 stderrors "errors" |
8 | 8 |
9 jc "github.com/juju/testing/checkers" | 9 jc "github.com/juju/testing/checkers" |
10 gc "launchpad.net/gocheck" | 10 gc "launchpad.net/gocheck" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 helperFunc: params.IsCodeUnauthorized, | 68 helperFunc: params.IsCodeUnauthorized, |
69 }, { | 69 }, { |
70 err: common.ErrNotLoggedIn, | 70 err: common.ErrNotLoggedIn, |
71 code: params.CodeUnauthorized, | 71 code: params.CodeUnauthorized, |
72 helperFunc: params.IsCodeUnauthorized, | 72 helperFunc: params.IsCodeUnauthorized, |
73 }, { | 73 }, { |
74 err: state.NotProvisionedError("0"), | 74 err: state.NotProvisionedError("0"), |
75 code: params.CodeNotProvisioned, | 75 code: params.CodeNotProvisioned, |
76 helperFunc: params.IsCodeNotProvisioned, | 76 helperFunc: params.IsCodeNotProvisioned, |
77 }, { | 77 }, { |
| 78 err: errors.NewAlreadyExistsError("blah"), |
| 79 code: params.CodeAlreadyExists, |
| 80 helperFunc: params.IsCodeAlreadyExists, |
| 81 }, { |
78 err: common.ErrUnknownWatcher, | 82 err: common.ErrUnknownWatcher, |
79 code: params.CodeNotFound, | 83 code: params.CodeNotFound, |
80 helperFunc: params.IsCodeNotFound, | 84 helperFunc: params.IsCodeNotFound, |
81 }, { | 85 }, { |
82 err: &state.NotAssignedError{&state.Unit{}}, // too sleazy?! nah.
. | 86 err: &state.NotAssignedError{&state.Unit{}}, // too sleazy?! nah.
. |
83 code: params.CodeNotAssigned, | 87 code: params.CodeNotAssigned, |
84 helperFunc: params.IsCodeNotAssigned, | 88 helperFunc: params.IsCodeNotAssigned, |
85 }, { | 89 }, { |
86 err: common.ErrStoppedWatcher, | 90 err: common.ErrStoppedWatcher, |
87 code: params.CodeStopped, | 91 code: params.CodeStopped, |
(...skipping 30 matching lines...) Expand all Loading... |
118 c.Assert(err1, gc.IsNil) | 122 c.Assert(err1, gc.IsNil) |
119 } else { | 123 } else { |
120 c.Assert(err1.Message, gc.Equals, t.err.Error()) | 124 c.Assert(err1.Message, gc.Equals, t.err.Error()) |
121 c.Assert(err1.Code, gc.Equals, t.code) | 125 c.Assert(err1.Code, gc.Equals, t.code) |
122 if t.helperFunc != nil { | 126 if t.helperFunc != nil { |
123 c.Assert(err1, jc.Satisfies, t.helperFunc) | 127 c.Assert(err1, jc.Satisfies, t.helperFunc) |
124 } | 128 } |
125 } | 129 } |
126 } | 130 } |
127 } | 131 } |
OLD | NEW |