當前位置: 首頁>>代碼示例>>Golang>>正文


Golang fake_ssh.FakeConnMetadata類代碼示例

本文整理匯總了Golang中github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_ssh.FakeConnMetadata的典型用法代碼示例。如果您正苦於以下問題:Golang FakeConnMetadata類的具體用法?Golang FakeConnMetadata怎麽用?Golang FakeConnMetadata使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FakeConnMetadata類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

	"github.com/onsi/gomega/ghttp"
	"github.com/pivotal-golang/lager/lagertest"
	"golang.org/x/crypto/ssh"
)

var _ = Describe("CFAuthenticator", func() {
	var (
		authenticator      *authenticators.CFAuthenticator
		logger             *lagertest.TestLogger
		httpClient         *http.Client
		httpClientTimeout  time.Duration
		permissionsBuilder *fake_authenticators.FakePermissionsBuilder

		permissions *ssh.Permissions
		authenErr   error

		metadata *fake_ssh.FakeConnMetadata
		password []byte

		fakeCC      *ghttp.Server
		fakeUAA     *ghttp.Server
		ccURL       string
		uaaTokenURL string
		uaaUsername string
		uaaPassword string
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")

		httpClientTimeout = time.Second
		httpClient = &http.Client{Timeout: httpClientTimeout}
開發者ID:benjaminharnett,項目名稱:diego-ssh,代碼行數:32,代碼來源:cf_authenticator_test.go

示例2:

	"github.com/cloudfoundry-incubator/diego-ssh/authenticators"
	"github.com/cloudfoundry-incubator/diego-ssh/authenticators/fake_authenticators"
	"github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_ssh"
	"github.com/pivotal-golang/lager/lagertest"
	"golang.org/x/crypto/ssh"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("DiegoProxyAuthenticator", func() {
	var (
		logger             *lagertest.TestLogger
		credentials        []byte
		permissionsBuilder *fake_authenticators.FakePermissionsBuilder
		authenticator      *authenticators.DiegoProxyAuthenticator
		metadata           *fake_ssh.FakeConnMetadata
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")
		credentials = []byte("some-user:some-password")
		permissionsBuilder = &fake_authenticators.FakePermissionsBuilder{}
		permissionsBuilder.BuildReturns(&ssh.Permissions{}, nil)
		authenticator = authenticators.NewDiegoProxyAuthenticator(logger, credentials, permissionsBuilder)

		metadata = &fake_ssh.FakeConnMetadata{}
	})

	Describe("Authenticate", func() {
開發者ID:swisscom,項目名稱:diego-ssh,代碼行數:30,代碼來源:diego_proxy_authenticator_test.go

示例3:

import (
	"errors"

	"github.com/cloudfoundry-incubator/diego-ssh/authenticators"
	"github.com/cloudfoundry-incubator/diego-ssh/authenticators/fake_authenticators"
	"github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_ssh"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"golang.org/x/crypto/ssh"
)

var _ = Describe("CompositeAuthenticator", func() {
	Describe("Authenticate", func() {
		var (
			authenticator    *authenticators.CompositeAuthenticator
			authenticatorMap map[string]authenticators.PasswordAuthenticator
			metadata         *fake_ssh.FakeConnMetadata
			password         []byte
		)

		BeforeEach(func() {
			authenticatorMap = map[string]authenticators.PasswordAuthenticator{}
			metadata = &fake_ssh.FakeConnMetadata{}
			password = []byte{}
		})

		JustBeforeEach(func() {
			authenticator = authenticators.NewCompositeAuthenticator(authenticatorMap)
		})

		Context("when no authenticators are specified", func() {
			It("fails to authenticate", func() {
開發者ID:sykesm,項目名稱:diego-ssh,代碼行數:32,代碼來源:composite_authenticator_test.go

示例4:

	"github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_ssh"
	"github.com/cloudfoundry-incubator/receptor"
	"github.com/cloudfoundry-incubator/receptor/fake_receptor"
	"github.com/pivotal-golang/lager/lagertest"
	"golang.org/x/crypto/ssh"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("DiegoProxyAuthenticator", func() {
	var (
		receptorClient     *fake_receptor.FakeClient
		expectedRoute      routes.SSHRoute
		desiredLRPResponse receptor.DesiredLRPResponse
		actualLrpResponse  receptor.ActualLRPResponse
		authenticator      *authenticators.DiegoProxyAuthenticator
		logger             *lagertest.TestLogger
		receptorCreds      []byte
		metadata           *fake_ssh.FakeConnMetadata
	)

	BeforeEach(func() {
		receptorClient = new(fake_receptor.FakeClient)

		expectedRoute = routes.SSHRoute{
			ContainerPort:   1111,
			PrivateKey:      "pem-encoded-key",
			HostFingerprint: "host-fingerprint",
			User:            "user",
			Password:        "password",
		}
開發者ID:sykesm,項目名稱:diego-ssh,代碼行數:32,代碼來源:diego_proxy_authenticator_test.go

示例5:

	"golang.org/x/crypto/ssh"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("PermissionsBuilder", func() {
	Describe("Build", func() {
		var (
			logger         *lagertest.TestLogger
			expectedRoute  routes.SSHRoute
			desiredLRP     *models.DesiredLRP
			actualLRPGroup *models.ActualLRPGroup
			bbsClient      *fake_bbs.FakeClient
			credentials    []byte
			metadata       *fake_ssh.FakeConnMetadata

			permissionsBuilder authenticators.PermissionsBuilder
			permissions        *ssh.Permissions
			buildErr           error
			processGuid        string
			index              int
		)

		BeforeEach(func() {
			logger = lagertest.NewTestLogger("test")

			expectedRoute = routes.SSHRoute{
				ContainerPort:   1111,
				PrivateKey:      "pem-encoded-key",
				HostFingerprint: "host-fingerprint",
開發者ID:benjaminharnett,項目名稱:diego-ssh,代碼行數:31,代碼來源:permissions_builder_test.go

示例6:

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/ghttp"
	"github.com/pivotal-golang/lager/lagertest"
	"golang.org/x/crypto/ssh"
)

var _ = Describe("CFAuthenticator", func() {
	var (
		authenticator   *authenticators.CFAuthenticator
		logger          *lagertest.TestLogger
		ccClient        *http.Client
		ccClientTimeout time.Duration
		receptorClient  *fake_receptor.FakeClient

		permissions *ssh.Permissions
		err         error

		metadata *fake_ssh.FakeConnMetadata
		password []byte

		fakeCC *ghttp.Server
		ccURL  string
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")
		ccClientTimeout = time.Second
		ccClient = &http.Client{Timeout: ccClientTimeout}
		receptorClient = new(fake_receptor.FakeClient)

		metadata = &fake_ssh.FakeConnMetadata{}
開發者ID:sykesm,項目名稱:diego-ssh,代碼行數:32,代碼來源:cf_authenticator_test.go


注:本文中的github.com/cloudfoundry-incubator/diego-ssh/test_helpers/fake_ssh.FakeConnMetadata類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。