Skip to content

Commit

Permalink
Refactor to share test
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Oct 9, 2023
1 parent feb5673 commit e45c6e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions scenario/featurecontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/owncloud/cs3api-validator/steps/login"
"github.com/owncloud/cs3api-validator/steps/publicshare"
"github.com/owncloud/cs3api-validator/steps/resources"
"github.com/owncloud/cs3api-validator/steps/share"
"github.com/owncloud/cs3api-validator/steps/spaces"
"github.com/owncloud/cs3api-validator/steps/sampletest"
)

// featureContext embeds all available feature contexts
Expand All @@ -18,7 +18,7 @@ type featureContext struct {
*publicshare.PublicShareFeatureContext
*resources.ResourcesFeatureContext
*spaces.SpacesFeatureContext
*sampletest.SampleTestFeatureContext
*share.ShareTestFeatureContext
}

// newFeatureContext returns a new feature context for the scenario initialization
Expand All @@ -34,7 +34,7 @@ func newFeatureContext(sc *godog.ScenarioContext) *featureContext {
PublicShareFeatureContext: publicshare.NewPublicShareFeatureContext(fc, sc),
ResourcesFeatureContext: resources.NewResourcesFeatureContext(fc, sc),
SpacesFeatureContext: spaces.NewSpacesFeatureContext(fc, sc),
SampleTestFeatureContext: sampletest.NewSampleTestFeatureContext(fc, sc),
ShareTestFeatureContext: share.NewSampleTestFeatureContext(fc, sc),
}
return uc
}
12 changes: 6 additions & 6 deletions steps/sampletest/context.go → steps/share/context.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package sampletest
package share

import (
"github.com/cucumber/godog"
"github.com/owncloud/cs3api-validator/featurecontext"
)

// SampleTestFeatureContext holds values which are used across test steps
type SampleTestFeatureContext struct {
// ShareTestFeatureContext holds values which are used across test steps
type ShareTestFeatureContext struct {
*featurecontext.FeatureContext
}

func NewSampleTestFeatureContext(fc *featurecontext.FeatureContext, sc *godog.ScenarioContext) *SampleTestFeatureContext {
nsc := &SampleTestFeatureContext{FeatureContext: fc}
func NewSampleTestFeatureContext(fc *featurecontext.FeatureContext, sc *godog.ScenarioContext) *ShareTestFeatureContext {
nsc := &ShareTestFeatureContext{FeatureContext: fc}
nsc.Register(sc)
return nsc
}

func (f *SampleTestFeatureContext) Register(ctx *godog.ScenarioContext) {
func (f *ShareTestFeatureContext) Register(ctx *godog.ScenarioContext) {
// steps
ctx.Step(`^user "([^"]*)" shares a file "([^"]*)" with the following users concurrently$`, f.UserSharesAFileWithTheFollowingUsers)
ctx.Step(`^the concurrent user sharing should have been successfull$`, f.TheConcurrentUserSharingShouldHaveBeenSuccessfull)
Expand Down
6 changes: 3 additions & 3 deletions steps/sampletest/steps.go → steps/share/steps.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sampletest
package share

import (
"fmt"
Expand All @@ -22,7 +22,7 @@ type CreateShareResult struct {

var concurentResults []*CreateShareResult

func (f *SampleTestFeatureContext) UserSharesAFileWithTheFollowingUsers(shareer string, resourceName string, sharees *godog.Table) error {
func (f *ShareTestFeatureContext) UserSharesAFileWithTheFollowingUsers(shareer string, resourceName string, sharees *godog.Table) error {
ctx, err := f.GetAuthContext(shareer)
if err != nil {
return err
Expand Down Expand Up @@ -152,7 +152,7 @@ func (f *SampleTestFeatureContext) UserSharesAFileWithTheFollowingUsers(shareer
return nil
}

func (f *SampleTestFeatureContext) TheConcurrentUserSharingShouldHaveBeenSuccessfull() error {
func (f *ShareTestFeatureContext) TheConcurrentUserSharingShouldHaveBeenSuccessfull() error {
//collect the result summary if there is any error while concurrent sharing
var isThereConcurrentError bool
var errorSummary string
Expand Down

0 comments on commit e45c6e7

Please sign in to comment.