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

Delta Between Two Patch Sets: state/apiserver/login_test.go

Issue 10026044: state/api: Split client Machiner into subpackage (Closed)
Left Patch Set: Created 11 years, 9 months ago
Right Patch Set: state/api: Split client Machiner into subpackage Created 11 years, 9 months 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:
Right: Side by side diff | Download
« no previous file with change/comment | « state/api/watcher.go ('k') | state/apiserver/server_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
(no file at all)
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 apiserver_test 4 package apiserver_test
5 5
6 import ( 6 import (
7 . "launchpad.net/gocheck" 7 . "launchpad.net/gocheck"
8 "launchpad.net/juju-core/state/api" 8 "launchpad.net/juju-core/state/api"
9 "launchpad.net/juju-core/state/apiserver" 9 "launchpad.net/juju-core/state/apiserver"
10 coretesting "launchpad.net/juju-core/testing" 10 coretesting "launchpad.net/juju-core/testing"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 for i, t := range badLoginTests { 62 for i, t := range badLoginTests {
63 c.Logf("test %d; entity %q; password %q", i, t.tag, t.password) 63 c.Logf("test %d; entity %q; password %q", i, t.tag, t.password)
64 info.Tag = "" 64 info.Tag = ""
65 info.Password = "" 65 info.Password = ""
66 func() { 66 func() {
67 st, err := api.Open(info) 67 st, err := api.Open(info)
68 c.Assert(err, IsNil) 68 c.Assert(err, IsNil)
69 defer st.Close() 69 defer st.Close()
70 70
71 » » » _, err = st.Machiner("") 71 » » » _, err = st.Machiner()
72 c.Assert(err, ErrorMatches, "not logged in") 72 c.Assert(err, ErrorMatches, "not logged in")
73 c.Assert(api.ErrCode(err), Equals, api.CodeUnauthorized, Commentf("error %#v", err)) 73 c.Assert(api.ErrCode(err), Equals, api.CodeUnauthorized, Commentf("error %#v", err))
74 74
75 // TODO (dimitern) This a really awkward way of testing - 75 // TODO (dimitern) This a really awkward way of testing -
76 // calling Login again here to reauth on the same 76 // calling Login again here to reauth on the same
77 // connection. Seems wrong. 77 // connection. Seems wrong.
78 err = st.Login(t.tag, t.password) 78 err = st.Login(t.tag, t.password)
79 c.Assert(err, ErrorMatches, t.err) 79 c.Assert(err, ErrorMatches, t.err)
80 c.Assert(api.ErrCode(err), Equals, t.code) 80 c.Assert(api.ErrCode(err), Equals, t.code)
81 81
82 » » » _, err = st.Machiner("") 82 » » » _, err = st.Machiner()
83 c.Assert(err, ErrorMatches, "not logged in") 83 c.Assert(err, ErrorMatches, "not logged in")
84 c.Assert(api.ErrCode(err), Equals, api.CodeUnauthorized) 84 c.Assert(api.ErrCode(err), Equals, api.CodeUnauthorized)
85 }() 85 }()
86 } 86 }
87 } 87 }
LEFTRIGHT

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