Skip to content

Commit bb1ccab

Browse files
committed
Refactor to share test
1 parent feb5673 commit bb1ccab

File tree

5 files changed

+17
-20
lines changed

5 files changed

+17
-20
lines changed

featurecontext/featurecontext.go

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

66
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
77
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
8-
shareClient "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
98
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
109
)
1110

@@ -24,7 +23,6 @@ type ResourceAlias struct {
2423
type FeatureContext struct {
2524
Client gateway.GatewayAPIClient
2625
HTTPClient http.Client
27-
ShareClient shareClient.CollaborationAPIClient
2826

2927
// remember the last response to check the outcome
3028
Response interface{}

features/concurrent-user-sharing.feature

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
Feature: concurrent user sharing
2-
As a users
3-
Users want to share their resource concurrently
2+
As a user
3+
I want to share their resource concurrently to different multiple users
4+
45

5-
@concurrent
66
Scenario: users make concurrent sharing to each other
77
Given user "admin" has logged in with password "admin"
88
And user "admin" has created a personal space with the alias "Admin Home"
9-
And user "admin" has uploaded a file "testfile1.txt" with content "concurrent sharing" in the home directory with the alias "testfile1"
10-
And user "admin" has uploaded a file "testfile2.txt" with content "concurrent sharing" in the home directory with the alias "testfile2"
11-
When user "admin" shares a file "testfile1.txt" with the following users concurrently
9+
And user "admin" has uploaded a file "testfile.txt" with content "concurrent sharing" in the home directory with the alias "testfile1"
10+
When user "admin" shares a file "testfile.txt" with the following users concurrently
1211
| users |
1312
| marie |
1413
| moss |

scenario/featurecontext.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"github.com/owncloud/cs3api-validator/steps/login"
77
"github.com/owncloud/cs3api-validator/steps/publicshare"
88
"github.com/owncloud/cs3api-validator/steps/resources"
9+
"github.com/owncloud/cs3api-validator/steps/share"
910
"github.com/owncloud/cs3api-validator/steps/spaces"
10-
"github.com/owncloud/cs3api-validator/steps/sampletest"
1111
)
1212

1313
// featureContext embeds all available feature contexts
@@ -18,7 +18,7 @@ type featureContext struct {
1818
*publicshare.PublicShareFeatureContext
1919
*resources.ResourcesFeatureContext
2020
*spaces.SpacesFeatureContext
21-
*sampletest.SampleTestFeatureContext
21+
*share.ShareTestFeatureContext
2222
}
2323

2424
// newFeatureContext returns a new feature context for the scenario initialization
@@ -34,7 +34,7 @@ func newFeatureContext(sc *godog.ScenarioContext) *featureContext {
3434
PublicShareFeatureContext: publicshare.NewPublicShareFeatureContext(fc, sc),
3535
ResourcesFeatureContext: resources.NewResourcesFeatureContext(fc, sc),
3636
SpacesFeatureContext: spaces.NewSpacesFeatureContext(fc, sc),
37-
SampleTestFeatureContext: sampletest.NewSampleTestFeatureContext(fc, sc),
37+
ShareTestFeatureContext: share.NewShareTestFeatureContext(fc, sc),
3838
}
3939
return uc
4040
}

steps/sampletest/context.go steps/share/context.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
package sampletest
1+
package share
22

33
import (
44
"github.com/cucumber/godog"
55
"github.com/owncloud/cs3api-validator/featurecontext"
66
)
77

8-
// SampleTestFeatureContext holds values which are used across test steps
9-
type SampleTestFeatureContext struct {
8+
// ShareTestFeatureContext holds values which are used across test steps
9+
type ShareTestFeatureContext struct {
1010
*featurecontext.FeatureContext
1111
}
1212

13-
func NewSampleTestFeatureContext(fc *featurecontext.FeatureContext, sc *godog.ScenarioContext) *SampleTestFeatureContext {
14-
nsc := &SampleTestFeatureContext{FeatureContext: fc}
13+
func NewShareTestFeatureContext(fc *featurecontext.FeatureContext, sc *godog.ScenarioContext) *ShareTestFeatureContext {
14+
nsc := &ShareTestFeatureContext{FeatureContext: fc}
1515
nsc.Register(sc)
1616
return nsc
1717
}
1818

19-
func (f *SampleTestFeatureContext) Register(ctx *godog.ScenarioContext) {
19+
func (f *ShareTestFeatureContext) Register(ctx *godog.ScenarioContext) {
2020
// steps
2121
ctx.Step(`^user "([^"]*)" shares a file "([^"]*)" with the following users concurrently$`, f.UserSharesAFileWithTheFollowingUsers)
2222
ctx.Step(`^the concurrent user sharing should have been successfull$`, f.TheConcurrentUserSharingShouldHaveBeenSuccessfull)

steps/sampletest/steps.go steps/share/steps.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package sampletest
1+
package share
22

33
import (
44
"fmt"
@@ -22,7 +22,7 @@ type CreateShareResult struct {
2222

2323
var concurentResults []*CreateShareResult
2424

25-
func (f *SampleTestFeatureContext) UserSharesAFileWithTheFollowingUsers(shareer string, resourceName string, sharees *godog.Table) error {
25+
func (f *ShareTestFeatureContext) UserSharesAFileWithTheFollowingUsers(shareer string, resourceName string, sharees *godog.Table) error {
2626
ctx, err := f.GetAuthContext(shareer)
2727
if err != nil {
2828
return err
@@ -152,7 +152,7 @@ func (f *SampleTestFeatureContext) UserSharesAFileWithTheFollowingUsers(shareer
152152
return nil
153153
}
154154

155-
func (f *SampleTestFeatureContext) TheConcurrentUserSharingShouldHaveBeenSuccessfull() error {
155+
func (f *ShareTestFeatureContext) TheConcurrentUserSharingShouldHaveBeenSuccessfull() error {
156156
//collect the result summary if there is any error while concurrent sharing
157157
var isThereConcurrentError bool
158158
var errorSummary string

0 commit comments

Comments
 (0)