Example #1
0
			Expect(*ec2Client.CreateKeyPairCall.Receives.Input.KeyName).To(Equal(keyName))
		})

		Context("when the SDK returns an error", func() {
			It("should return the error", func() {
				ec2Client.CreateKeyPairCall.Returns.Error = errors.New("some error")

				_, err := client.CreateKeyPair(keyName)
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("DeleteKeyPair", func() {
		It("should call the SDK DeleteKeyPair function", func() {
			Expect(client.DeleteKeyPair(keyName)).To(Succeed())

			Expect(*ec2Client.DeleteKeyPairCall.Receives.Input.KeyName).To(Equal(keyName))
		})

		Context("when the SDK returns an error", func() {
			It("should return the error", func() {
				ec2Client.DeleteKeyPairCall.Returns.Error = errors.New("some error")

				Expect(client.DeleteKeyPair(keyName)).To(MatchError("some error"))
			})
		})
	})
})