当前位置: 首页>>代码示例>>Golang>>正文


Golang configuration.NewRepositoryWithAccessToken函数代码示例

本文整理汇总了Golang中testhelpers/configuration.NewRepositoryWithAccessToken函数的典型用法代码示例。如果您正苦于以下问题:Golang NewRepositoryWithAccessToken函数的具体用法?Golang NewRepositoryWithAccessToken怎么用?Golang NewRepositoryWithAccessToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewRepositoryWithAccessToken函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: callShareDomain

func callShareDomain(args []string, reqFactory *testreq.FakeReqFactory, domainRepo *testapi.FakeDomainRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("create-shared-domain", args)
	configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})
	cmd := NewCreateSharedDomain(fakeUI, configRepo, domainRepo)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
开发者ID:knolleary,项目名称:cli,代码行数:8,代码来源:create_shared_domain_test.go

示例2: callListDomains

func callListDomains(args []string, reqFactory *testreq.FakeReqFactory, domainRepo *testapi.FakeDomainRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("domains", args)

	configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"

	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := domain.NewListDomains(fakeUI, configRepo, domainRepo)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
开发者ID:knolleary,项目名称:cli,代码行数:19,代码来源:list_domains_test.go

示例3: callCreateRoute

func callCreateRoute(args []string, requirementsFactory *testreq.FakeReqFactory, routeRepo *testapi.FakeRouteRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("create-route", args)

	configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"
	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := NewCreateRoute(fakeUI, configRepo, routeRepo)

	testcmd.RunCommand(cmd, ctxt, requirementsFactory)
	return
}
开发者ID:nota-ja,项目名称:cli,代码行数:19,代码来源:create_route_test.go

示例4: callListQuotas

func callListQuotas(reqFactory *testreq.FakeReqFactory, quotaRepo *testapi.FakeQuotaRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = &testterm.FakeUI{}
	ctxt := testcmd.NewContext("quotas", []string{})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"

	token := configuration.TokenInfo{Username: "my-user"}
	config := testconfig.NewRepositoryWithAccessToken(token)
	config.SetSpaceFields(spaceFields)
	config.SetOrganizationFields(orgFields)

	cmd := organization.NewListQuotas(fakeUI, config, quotaRepo)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
开发者ID:knolleary,项目名称:cli,代码行数:19,代码来源:list_quotas_test.go

示例5: callShowOrg

func callShowOrg(args []string, reqFactory *testreq.FakeReqFactory) (ui *testterm.FakeUI) {
	ui = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("org", args)

	token := configuration.TokenInfo{Username: "my-user"}

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"

	configRepo := testconfig.NewRepositoryWithAccessToken(token)
	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := NewShowOrg(ui, configRepo)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
开发者ID:knolleary,项目名称:cli,代码行数:20,代码来源:show_org_test.go

示例6: callDeleteSharedDomain

func callDeleteSharedDomain(args []string, inputs []string, deps deleteSharedDomainDependencies) (ui *testterm.FakeUI) {
	ctxt := testcmd.NewContext("delete-domain", args)
	ui = &testterm.FakeUI{
		Inputs: inputs,
	}

	configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"
	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := domain.NewDeleteSharedDomain(ui, configRepo, deps.domainRepo)
	testcmd.RunCommand(cmd, ctxt, deps.requirementsFactory)
	return
}
开发者ID:nota-ja,项目名称:cli,代码行数:20,代码来源:delete_shared_domain_test.go

示例7: callCreateOrg

func callCreateOrg(args []string, requirementsFactory *testreq.FakeReqFactory, orgRepo *testapi.FakeOrgRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("create-org", args)

	space := models.SpaceFields{}
	space.Name = "my-space"

	organization := models.OrganizationFields{}
	organization.Name = "my-org"

	token := configuration.TokenInfo{Username: "my-user"}
	config := testconfig.NewRepositoryWithAccessToken(token)
	config.SetSpaceFields(space)
	config.SetOrganizationFields(organization)

	cmd := NewCreateOrg(fakeUI, config, orgRepo)

	testcmd.RunCommand(cmd, ctxt, requirementsFactory)
	return
}
开发者ID:nota-ja,项目名称:cli,代码行数:20,代码来源:create_org_test.go

示例8:

				{"Not logged in", "Use", "log in"},
			})
		})

	})

	Context("when an api endpoint is set and the user logged in", func() {
		var config configuration.ReadWriter

		BeforeEach(func() {
			accessToken := configuration.TokenInfo{
				UserGuid: "my-user-guid",
				Username: "my-user",
				Email:    "my-user-email",
			}
			config = testconfig.NewRepositoryWithAccessToken(accessToken)
			config.SetApiEndpoint("https://test.example.org")
			config.SetApiVersion("☃☃☃")
		})

		Describe("tells the user what is set in the config", func() {
			var output []string

			JustBeforeEach(func() {
				output = captureOutput(func() {
					ui := NewUI(os.Stdin)
					ui.ShowConfiguration(config)
				})
			})

			It("tells the user which api endpoint is set", func() {
开发者ID:knolleary,项目名称:cli,代码行数:31,代码来源:ui_test.go

示例9:

		space := models.SpaceFields{}
		space.Guid = "my-space-guid"
		space.Name = "my-space"
		domain := models.DomainFields{}
		domain.Guid = "domain-guid"
		domain.Name = "example.com"

		createdRoute := models.Route{}
		createdRoute.Host = "my-host"
		createdRoute.Guid = "my-route-guid"
		routeRepo := &testapi.FakeRouteRepository{
			CreateInSpaceCreatedRoute: createdRoute,
		}

		ui := new(testterm.FakeUI)
		configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})
		orgFields := models.OrganizationFields{}
		orgFields.Name = "my-org"
		configRepo.SetOrganizationFields(orgFields)

		cmd := NewCreateRoute(ui, configRepo, routeRepo)
		route, apiErr := cmd.CreateRoute("my-host", domain, space)

		Expect(route.Guid).To(Equal(createdRoute.Guid))

		Expect(apiErr).NotTo(HaveOccurred())

		testassert.SliceContains(ui.Outputs, testassert.Lines{
			{"Creating route", "my-host.example.com", "my-org", "my-space", "my-user"},
			{"OK"},
		})
开发者ID:nota-ja,项目名称:cli,代码行数:31,代码来源:create_route_test.go

示例10:

		org1 := models.Organization{}
		org1.Name = "Organization-1"

		org2 := models.Organization{}
		org2.Name = "Organization-2"

		org3 := models.Organization{}
		org3.Name = "Organization-3"

		orgRepo := &testapi.FakeOrgRepository{
			Organizations: []models.Organization{org1, org2, org3},
		}

		reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
		tokenInfo := configuration.TokenInfo{Username: "my-user"}
		config := testconfig.NewRepositoryWithAccessToken(tokenInfo)

		ui := callListOrgs(config, reqFactory, orgRepo)

		testassert.SliceContains(ui.Outputs, testassert.Lines{
			{"Getting orgs as my-user"},
			{"Organization-1"},
			{"Organization-2"},
			{"Organization-3"},
		})
	})

	It("TestListNoOrgs", func() {
		orgs := []models.Organization{}
		orgRepo := &testapi.FakeOrgRepository{
			Organizations: orgs,
开发者ID:knolleary,项目名称:cli,代码行数:31,代码来源:list_orgs_test.go


注:本文中的testhelpers/configuration.NewRepositoryWithAccessToken函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。