-
Notifications
You must be signed in to change notification settings - Fork 160
/
AccountRoleService.feature
130 lines (115 loc) · 5.7 KB
/
AccountRoleService.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
###############################################################################
# Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Eurotech - initial API and implementation
###############################################################################
@account
@role
@integration
Feature: Account Role Service Integration Tests
Scenario: Init Security Context for all scenarios
Given Init Security Context
Scenario: Creating Roles Under Account That Allows Infinite Child Roles
Login as kapua-sys, create an account
Configure RoleRegistryService of that account, set infiniteChildRoles to true and maxNumberChildRoles to 0
Create a few Roles
No exception should be thrown
Given I login as user with name "kapua-sys" and password "kapua-password"
Then I create an account with name "acc1", organization name "acc1" and email address "acc1@org.com"
And I configure the role service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 0 |
Given I select account "acc1"
When I create role "role1" in account "acc1"
And I create role "role2" in account "acc1"
And I create role "role3" in account "acc1"
Then No exception was thrown
And I logout
Scenario: Creating Roles Under Account That Has Limited Child Roles
Login as kapua-sys, create an account
Configure RoleRegistryService of that account, set infiniteChildRoles to false and maxNumberChildRoles to 3
Create a few Roles
Only 3 Roles should be created, creating more will throw an Exception
Given I login as user with name "kapua-sys" and password "kapua-password"
Then I create an account with name "acc1", organization name "acc1" and email address "acc1@org.com"
And I configure the role service
| type | name | value |
| boolean | infiniteChildEntities | false |
| integer | maxNumberChildEntities | 3 |
Given I select account "acc1"
When I create role "role1" in account "acc1"
And I create role "role2" in account "acc1"
And I create role "role3" in account "acc1"
Given I expect the exception "KapuaMaxNumberOfItemsReachedException" with the text "*"
When I create role "role4" in account "acc1"
Then An exception was thrown
And I logout
Scenario: Creating Roles Under Account That Does Not Allow Roles
Login as kapua-sys, create an account
Configure RoleRegistryService of that account, set infiniteChildRoles to false and maxNumberChildRoles to 0
Try to create a group
Exception should be thrown
Given I login as user with name "kapua-sys" and password "kapua-password"
Then I create an account with name "acc1", organization name "acc1" and email address "acc1@org.com"
And I configure the role service
| type | name | value |
| boolean | infiniteChildEntities | false |
| integer | maxNumberChildEntities | 0 |
Given I select account "acc1"
Given I expect the exception "KapuaMaxNumberOfItemsReachedException" with the text "*"
When I create role "role4" in account "acc1"
Then An exception was thrown
And I logout
Scenario: Creating Roles And Than Setting Role Service So It Does Not Allow Roles
Login as kapua-sys, create an account
Configure RoleRegistryService of that account, set infiniteChildRoles to true
Create a few Roles
Configure RoleRegistryService of that account, set infiniteChildRoles to false
Exception should be thrown
Given I login as user with name "kapua-sys" and password "kapua-password"
Then I create an account with name "acc1", organization name "acc1" and email address "acc1@org.com"
And I configure the role service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 0 |
Given I select account "acc1"
When I create role "role1" in account "acc1"
When I create role "role2" in account "acc1"
Given I expect the exception "ServiceConfigurationLimitExceededException" with the text "*"
And I configure the role service
| type | name | value |
| boolean | infiniteChildEntities | false |
| integer | maxNumberChildEntities | 0 |
Then An exception was thrown
And I logout
Scenario: Creating Roles And Then Changing Role Service Values
Login as kapua-sys, create an account
Configure RoleRegistryService of that account, set infiniteChildRoles to true
Create 2 Roles
Configure RoleRegistryService of that account, set infiniteChildRoles to false and maxNumberChildRoles to 2
No exception should be thrown
Given I login as user with name "kapua-sys" and password "kapua-password"
Then I create an account with name "acc1", organization name "acc1" and email address "acc1@org.com"
And I configure the role service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 0 |
Given I select account "acc1"
When I create role "role1" in account "acc1"
When I create role "role2" in account "acc1"
And I configure the role service
| type | name | value |
| boolean | infiniteChildEntities | false |
| integer | maxNumberChildEntities | 2 |
Then No exception was thrown
And I logout
Scenario: Reset Security Context for all scenarios
Given Reset Security Context