예제 #1
0
파일: api_test.go 프로젝트: dasnook/godog
func featureContext(s *godog.Suite) {
	api := &apiFeature{}

	s.BeforeScenario(api.resetResponse)

	s.Step(`^I send "(GET|POST|PUT|DELETE)" request to "([^"]*)"$`, api.iSendrequestTo)
	s.Step(`^the response code should be (\d+)$`, api.theResponseCodeShouldBe)
	s.Step(`^the response should match json:$`, api.theResponseShouldMatchJSON)
	s.Step(`^there are users:$`, api.thereAreUsers)
}
예제 #2
0
// FeatureContextBootstrap setup the FeatureContext  for bootstrap steps
func FeatureContextBootstrap(bddCtx *BDDContext, s *godog.Suite) {

	s.Step(`^the orderer network has organizations:$`, bddCtx.theOrdererNetworkHasOrganizations)
	//s.Step(`^user requests role of orderer admin by creating a key and csr for orderer and acquires signed certificate from organization:$`, userRequestsRoleOfOrdererAdminByCreatingAKeyAndCsrForOrdererAndAcquiresSignedCertificateFromOrganization)
	//s.Step(`^the peer network has organizations:$`, thePeerNetworkHasOrganizations)
	//s.Step(`^a chainBootstrapAdmin is identified and given access to all public certificates and orderer node info$`, aChainBootstrapAdminIsIdentifiedAndGivenAccessToAllPublicCertificatesAndOrdererNodeInfo)
	//s.Step(`^the chainBootstrapAdmin creates the genesis block for chain \'chain(\d+)\' for network config policy \'unanimous\' and consensus \'solo\' and peer organizations:$`, theChainBootstrapAdminCreatesTheGenesisBlockForChainChainForNetworkConfigPolicyUnanimousAndConsensusSoloAndPeerOrganizations)
	//s.Step(`^the orderer admins inspect and approve the genesis block for chain \'chain(\d+)\'$`, theOrdererAdminsInspectAndApproveTheGenesisBlockForChainChain)
	//s.Step(`^the orderer admins use the genesis block for chain \'chain(\d+)\' to configure orderers$`, theOrdererAdminsUseTheGenesisBlockForChainChainToConfigureOrderers)
	//s.Step(`^user requests role of peer admin by creating a key and csr for peer and acquires signed certificate from organization:$`, userRequestsRoleOfPeerAdminByCreatingAKeyAndCsrForPeerAndAcquiresSignedCertificateFromOrganization)
	//s.Step(`^peer admins get the genesis block for chain \'chain(\d+)\' from chainBoostrapAdmin$`, peerAdminsGetTheGenesisBlockForChainChainFromChainBoostrapAdmin)
	//s.Step(`^the peer admins inspect and approve the genesis block for chain \'chain(\d+)\'$`, thePeerAdminsInspectAndApproveTheGenesisBlockForChainChain)
	//s.Step(`^the peer admins use the genesis block for chain \'chain(\d+)\' to configure peers$`, thePeerAdminsUseTheGenesisBlockForChainChainToConfigurePeers)
	//s.Step(`^user "([^"]*)" registers with peer organization "([^"]*)"$`, userRegistersWithPeerOrganization)
}
예제 #3
0
파일: godog_test.go 프로젝트: dasnook/godog
func featureContext(s *godog.Suite) {
	s.Step(`^there are (\d+) godogs$`, thereAreGodogs)
	s.Step(`^I eat (\d+)$`, iEat)
	s.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)

	s.BeforeScenario(func(interface{}) {
		Godogs = 0 // clean the state before every scenario
	})
}
예제 #4
0
func featureContext(s *godog.Suite) {
	wcf := NewWebCrawlingFeature()

	s.BeforeScenario(wcf.Reset)

	s.Step(`^an invalid url "([^"]*)"$`, wcf.anInvalidUrl)
	s.Step(`^I run the crawler with the following arguments "([^"]*)"$`, wcf.iRunTheCrawlerWithTheFollowingArguments)
	s.Step(`^I should see an error informing me "([^"]*)"$`, wcf.iShouldSeeAnErrorInformingMe)
	s.Step(`^a unfetchable url "([^"]*)"$`, wcf.aUnfetchableUrl)
	s.Step(`^the exit code should be: (\d+)$`, wcf.theExitCodeShouldBe)
	s.Step(`^a webpage "([^"]*)" containing:$`, wcf.aWebpagecontaining)
	s.Step(`^the webpages are being hosted locally$`, wcf.theWebpagesAreBeingHostedLocally)
	s.Step(`^I run the crawler with the locally hosted url$`, wcf.iRunTheCrawlerWithTheLocallyHostedUrl)
	s.Step(`^I should see the following:$`, wcf.iShouldSeeTheFollowing)
}
예제 #5
0
func FeatureContext(s *godog.Suite) {
	bddCtx := &BDDContext{godogSuite: s, users: make(map[string]*UserRegistration), grpcClientPort: 7051}

	s.BeforeScenario(bddCtx.beforeScenario)
	s.AfterScenario(bddCtx.afterScenarioDecompose)

	FeatureContextBootstrap(bddCtx, s)

	s.Step(`^we compose "([^"]*)"$`, bddCtx.weCompose)
	s.Step(`^requesting "([^"]*)" from "([^"]*)"$`, bddCtx.requestingFrom)
	s.Step(`^I should get a JSON response with array "([^"]*)" contains "([^"]*)" elements$`, bddCtx.iShouldGetAJSONResponseWithArrayContainsElements)
	s.Step(`^I wait "([^"]*)" seconds$`, bddCtx.iWaitSeconds)
	s.Step(`^I register with CA supplying username "([^"]*)" and secret "([^"]*)" on peers:$`, bddCtx.iRegisterWithCASupplyingUsernameAndSecretOnPeers)
	s.Step(`^user "([^"]*)" creates a chaincode spec "([^"]*)" of type "([^"]*)" for chaincode "([^"]*)" with args$`, bddCtx.userCreatesAChaincodeSpecOfTypeForChaincodeWithArgs)

	s.Step(`^user "([^"]*)" creates a deployment spec "([^"]*)" using chaincode spec "([^"]*)" and devops on peer "([^"]*)"$`, bddCtx.userCreatesADeploymentSpecUsingChaincodeSpecAndDevopsOnPeer)
	//s.Step(`^user "([^"]*)" creates a deployment spec "([^"]*)" using chaincode spec "([^"]*)"$`, bddCtx.userCreatesADeploymentSpecUsingChaincodeSpec)

	s.Step(`^user "([^"]*)" creates a deployment proposal "([^"]*)" using chaincode deployment spec "([^"]*)"$`, bddCtx.userCreatesADeploymentProposalUsingChaincodeDeploymentSpec)
	s.Step(`^user "([^"]*)" sends proposal "([^"]*)" to endorsers with timeout of "([^"]*)" seconds:$`, bddCtx.userSendsProposalToEndorsersWithTimeoutOfSeconds)
	s.Step(`^user "([^"]*)" stores their last result as "([^"]*)"$`, bddCtx.userStoresTheirLastResultAs)
	s.Step(`^user "([^"]*)" expects proposal responses "([^"]*)" with status "([^"]*)" from endorsers:$`, bddCtx.userExpectsProposalResponsesWithStatusFromEndorsers)
	s.Step(`^user "([^"]*)" sets ESCC to "([^"]*)" for chaincode spec "([^"]*)"$`, bddCtx.userSetsESCCToForChaincodeSpec)
	s.Step(`^user "([^"]*)" sets VSCC to "([^"]*)" for chaincode spec "([^"]*)"$`, bddCtx.userSetsVSCCToForChaincodeSpec)
}
func featureContext(s *godog.Suite) {
	s.BeforeScenario(func(interface{}) {
		updater = &ServiceUpdater{
			ServiceRepository: NewInMemoryServiceRepository(),
			RouterClient:      NewInMemoryVampRouterClient(),
			Configuration: Configuration{
				RootDns: "example.com",
			},
		}
	})

	s.Step(`^a k8s service named "([^"]*)" is created in the namespace "([^"]*)"$`, aKsServiceNamedIsCreatedInTheNamespace)
	s.Step(`^a k8s service named "([^"]*)" is created in the namespace "([^"]*)" with the IP "([^"]*)"$`, aKsServiceNamedIsCreatedInTheNamespaceWithTheIP)
	s.Step(`^the vamp service "([^"]*)" should be created$`, theVampServiceShouldBeCreated)
	s.Step(`^the vamp route "([^"]*)" should be created$`, theVampRouteShouldBeCreated)
	s.Step(`^a vamp route named "([^"]*)" already exists$`, aVampRouteNamedAlreadyExists)
	s.Step(`^the vamp filter named "([^"]*)" should be created$`, theVampFilterNamedShouldBeCreated)
	s.Step(`^the vamp service "([^"]*)" should only contain the backend "([^"]*)"$`, theVampServiceShouldOnlyContainTheBackend)
	s.Step(`^a k8s service named "([^"]*)" is updated in the namespace "([^"]*)" with the IP "([^"]*)"$`, aKsServiceNamedIsUpdatedInTheNamespaceWithTheIP)
	s.Step(`^the vamp route should not be updated$`, theVampRouteShouldNotBeUpdated)
	s.Step(`^the vamp route should be updated$`, theVampRouteShouldBeUpdated)
	s.Step(`^the k8s service "([^"]*)" is in the namespace "([^"]*)"$`, theKsServiceisInTheNamespace)
	s.Step(`^the k8s service "([^"]*)" IP is "([^"]*)"$`, theKsServiceIPIs)
	s.Step(`^the k8s service named "([^"]*)" is created$`, theKsServiceNamedisCreated)
	s.Step(`^the k8s service named "([^"]*)" is updated$`, theKsServiceNamedisUpdated)
	s.Step(`^the k8s service "([^"]*)" has the following annotations:$`, theKsServicehasTheFollowingAnnotations)
}