This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmpa-7603-Organization-service-Leave-Organization.feature
69 lines (50 loc) · 3.9 KB
/
mpa-7603-Organization-service-Leave-Organization.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@Configuration-service-production-ready
Feature: Organization service Org management - Leave Organization
Any member of the relevant Organization should be able to leave it by own decision.
Nevertheless at least one Owner should be persisted in the relevant Organization.
#__________________________________________________POSITIVE___________________________________________________________
#MPA-7603 (#28)
Scenario: Owner successfully leaved a relevant Organization
Given the user "A" have got a valid "token" issued by relevant authority
And only single organization "organizationId" with specified "name" and "email" already created and owned by user "A"
And the user "B" who have got the "userId" issued by relevant authority was invited to user's "A" organization with an "owner" role
When the user "A" requested to leave own organization
Then user "A" should leave the relevant organization and receive the empty object
#MPA-7603 (#29)
Scenario: Admin successfully leaved a relevant Organization
Given the user "A" have got a valid "token" issued by relevant authority
And only single organization "organizationId" with specified "name" and "email" already created and owned by user "A"
And the user "B" who have got the "userId" issued by relevant authority was invited to user's "A" organization with an "admin" role
When the user "B" requested to leave user's "A" organization
Then user "B" should leave the relevant organization and receive the empty object
#MPA-7603 (#30)
Scenario: Member successfully leaved a relevant Organization
Given the user "A" have got a valid "token" issued by relevant authority
And only single organization "organizationId" with specified "name" and "email" already created and owned by user "A"
And the user "C" who have got the "userId" issued by relevant authority was invited to user's "A" organization with a "member" role
When the user "C" requested to leave user's "A" organization
Then user "C" should leave the relevant organization and receive the empty object
#__________________________________________________NEGATIVE___________________________________________________________
#MPA-7603 (#31)
Scenario: Fail to leave a relevant Organization by the single owner
Given the user "A" have got a valid "token" issued by relevant authority
And only single organization "organizationId" with specified "name" and "email" already created and owned by user "A"
When the user "A" requested to leave own organization
Then user "A" should should receive the error message:"At least one Owner should be persisted in the organization: 'org A id'"
#MPA-7603 (#32) - should we return an error like " is not a "member" of organization" instead of empty object?
Scenario: Fail to leave the Organization upon the user wasn't invited to any of the relevant Organizations
Given each of the users "A" and "B" have got personal valid "token" issued by relevant authority
And only single organization "organizationId" with specified "name" and "email" already created and owned by user "A"
When the user "B" requested to leave the user's "A" organization
Then the user "B" should receive successful response with empty object
#MPA-7603 (#33)
Scenario: Fail to leave a non-existent Organization
Given the user "A" have got a valid "token" issued by relevant authority
And there is no organization "organizationId" was created and stored
When the user "A" requested to leave the "non-existent" organizationId
Then user "A" should receive the error message: "Organization [id=non-existent] not found"
#MPA-7603 (#34)
Scenario: Fail to leave the Organization if the token is invalid (expired)
Given a user have got the invalid either expired "token"
When this user requested to leave some Organization "organizationId"
Then this user should receive the error message: "Token verification failed"