~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cmd/juju/commands/sshkeys_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
        // Block operation
144
144
        s.BlockAllChanges(c, "TestBlockAddKey")
145
145
        _, err := coretesting.RunCommand(c, NewAddKeysCommand(), key2, "invalid-key")
146
 
        s.AssertBlocked(c, err, ".*TestBlockAddKey.*")
 
146
        coretesting.AssertOperationWasBlocked(c, err, ".*TestBlockAddKey.*")
147
147
}
148
148
 
149
149
type RemoveKeySuite struct {
173
173
        s.BlockAllChanges(c, "TestBlockRemoveKeys")
174
174
        _, err := coretesting.RunCommand(c, NewRemoveKeysCommand(),
175
175
                sshtesting.ValidKeyTwo.Fingerprint, "invalid-key")
176
 
        s.AssertBlocked(c, err, ".*TestBlockRemoveKeys.*")
 
176
        coretesting.AssertOperationWasBlocked(c, err, ".*TestBlockRemoveKeys.*")
177
177
}
178
178
 
179
179
type ImportKeySuite struct {
191
191
        key1 := sshtesting.ValidKeyOne.Key + " user@host"
192
192
        s.setAuthorizedKeys(c, key1)
193
193
 
194
 
        context, err := coretesting.RunCommand(c, NewImportKeysCommand(), "lp:validuser", "invalid-key")
 
194
        context, err := coretesting.RunCommand(c, NewImportKeysCommand(), "lp:validuser", "lp:invalid-key")
195
195
        c.Assert(err, jc.ErrorIsNil)
196
 
        c.Assert(coretesting.Stderr(context), gc.Matches, `cannot import key id "invalid-key".*\n`)
 
196
        c.Assert(coretesting.Stderr(context), gc.Matches, `cannot import key id "lp:invalid-key".*\n`)
197
197
        s.assertEnvironKeys(c, key1, sshtesting.ValidKeyThree.Key)
198
198
}
199
199
 
203
203
 
204
204
        // Block operation
205
205
        s.BlockAllChanges(c, "TestBlockImportKeys")
206
 
        _, err := coretesting.RunCommand(c, NewImportKeysCommand(), "lp:validuser", "invalid-key")
207
 
        s.AssertBlocked(c, err, ".*TestBlockImportKeys.*")
 
206
        _, err := coretesting.RunCommand(c, NewImportKeysCommand(), "lp:validuser", "lp:invalid-key")
 
207
        coretesting.AssertOperationWasBlocked(c, err, ".*TestBlockImportKeys.*")
208
208
}