})
		})

		Context("when authentication is successful", func() {
			BeforeEach(func() {
				metadata.UserReturns("diego:some-guid/0")
				password = []byte("receptor-user:receptor-password")
			})

			It("gets information about the desired lrp referenced in the username", func() {
				Expect(receptorClient.GetDesiredLRPCallCount()).To(Equal(1))
				Expect(receptorClient.GetDesiredLRPArgsForCall(0)).To(Equal("some-guid"))
			})

			It("gets information about the the actual lrp from the username", func() {
				Expect(receptorClient.ActualLRPByProcessGuidAndIndexCallCount()).To(Equal(1))

				guid, index := receptorClient.ActualLRPByProcessGuidAndIndexArgsForCall(0)
				Expect(guid).To(Equal("some-guid"))
				Expect(index).To(Equal(0))
			})

			It("saves container information in the critical options of the permissions", func() {
				expectedConfig := `{
					"address": "1.2.3.4:3333",
					"host_fingerprint": "host-fingerprint",
					"private_key": "pem-encoded-key",
					"user": "******",
					"password": "******"
				}`