-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#17776 from Aflynn50/3.4-3.5
juju#17776 There were no merge conflicts in this merge up. This merge contains the following PRs: - juju#17772 from Aflynn50 - juju#17700 from Aflynn50 - juju#17756 from nvinuesa Did some quick QA for the external users: ``` juju bootstrap lxd test-external-34 --config identity-url=https://api.jujucharms.com/identity --config allow-model-access=true juju add-model default juju grant aflynn50@external superuser juju change-user-password juju logout juju login -u aflynn50@external juju status ```
- Loading branch information
Showing
11 changed files
with
764 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import ( | |
cookiejar "github.com/juju/persistent-cookiejar" | ||
"github.com/juju/testing" | ||
jc "github.com/juju/testing/checkers" | ||
"go.uber.org/mock/gomock" | ||
gc "gopkg.in/check.v1" | ||
"gopkg.in/macaroon-bakery.v2/httpbakery" | ||
"gopkg.in/macaroon.v2" | ||
|
@@ -25,6 +26,7 @@ import ( | |
apitesting "github.com/juju/juju/api/testing" | ||
"github.com/juju/juju/cloud" | ||
"github.com/juju/juju/cmd/modelcmd" | ||
"github.com/juju/juju/cmd/modelcmd/mocks" | ||
"github.com/juju/juju/core/model" | ||
"github.com/juju/juju/core/network" | ||
"github.com/juju/juju/environs" | ||
|
@@ -190,6 +192,42 @@ To access it run 'juju switch bar:admin/badmodel'.`, | |
} | ||
} | ||
|
||
func (s *BaseCommandSuite) setupMocks(c *gc.C) *gomock.Controller { | ||
ctrl := gomock.NewController(c) | ||
return ctrl | ||
} | ||
|
||
func (s *BaseCommandSuite) TestNewAPIRootExternalUser(c *gc.C) { | ||
ctrl := s.setupMocks(c) | ||
conn := mocks.NewMockConnection(ctrl) | ||
apiOpen := func(info *api.Info, opts api.DialOpts) (api.Connection, error) { | ||
return conn, nil | ||
} | ||
externalName := "alastair@external" | ||
conn.EXPECT().AuthTag().Return(names.NewUserTag(externalName)).MinTimes(1) | ||
conn.EXPECT().APIHostPorts() | ||
conn.EXPECT().ServerVersion() | ||
conn.EXPECT().Addr() | ||
conn.EXPECT().IPAddr() | ||
conn.EXPECT().PublicDNSName() | ||
conn.EXPECT().ControllerAccess().MinTimes(1) | ||
|
||
s.store.Accounts["foo"] = jujuclient.AccountDetails{ | ||
User: externalName, | ||
} | ||
|
||
baseCmd := new(modelcmd.ModelCommandBase) | ||
baseCmd.SetClientStore(s.store) | ||
baseCmd.SetAPIOpen(apiOpen) | ||
modelcmd.InitContexts(&cmd.Context{Stderr: io.Discard}, baseCmd) | ||
modelcmd.SetRunStarted(baseCmd) | ||
|
||
c.Assert(baseCmd.SetModelIdentifier("foo:admin/badmodel", false), jc.ErrorIsNil) | ||
|
||
_, err := baseCmd.NewAPIRoot() | ||
c.Assert(err, jc.ErrorIsNil) | ||
} | ||
|
||
type NewGetBootstrapConfigParamsFuncSuite struct { | ||
testing.IsolationSuite | ||
} | ||
|
@@ -462,7 +500,9 @@ func (s *BaseCommandSuite) TestProcessAccountDetails(c *gc.C) { | |
input: jujuclient.AccountDetails{ | ||
User: names.NewUserTag("[email protected]").String(), | ||
}, | ||
expectedOutput: jujuclient.AccountDetails{}, | ||
expectedOutput: jujuclient.AccountDetails{ | ||
User: names.NewUserTag("[email protected]").String(), | ||
}, | ||
}} | ||
for i, test := range tests { | ||
c.Logf("running test case %d", i) | ||
|
Oops, something went wrong.