Skip to content

Commit

Permalink
post-rebase fixes
Browse files Browse the repository at this point in the history
Signed-off-by: dseurotech <davide.salvador@eurotech.com>
  • Loading branch information
dseurotech committed Apr 23, 2024
1 parent fe5c6a2 commit ac91559
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 100 deletions.
Expand Up @@ -12,15 +12,15 @@
*******************************************************************************/
package org.eclipse.kapua.integration.rest;

import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
features = "classpath:features/rest/user/RestUser.feature",
glue = {"org.eclipse.kapua.qa.common",
glue = { "org.eclipse.kapua.qa.common",
"org.eclipse.kapua.qa.integration.steps",
"org.eclipse.kapua.service.account.steps",
"org.eclipse.kapua.service.user.steps"
Expand All @@ -32,4 +32,5 @@
monochrome = true)

public class RunRestUserTest {

}
Expand Up @@ -517,93 +517,4 @@ Feature: Account expiration features

@teardown
Scenario: Reset Security Context for all scenarios
Given Reset Security Context
| | | | | | | |

Scenario: User cannot modify expiration date of the account in which it is defined
A user defined inside an account cannot update the expiration date if its account.
In this test the user tries to change the expiration date from a defined date to a "no expiration date".

When I login as user with name "kapua-sys" and password "kapua-password"
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 50 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 20 |
Given Account
| name | scopeId | expirationDate |
| account-a | 1 | tomorrow |
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 10 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
And User A
| name | displayName | email | phoneNumber | status | userType |
| kapua-a | Kapua User A | kapua_a@kapua.com | +386 31 323 444 | ENABLED | INTERNAL |
And I add credentials
| name | password | enabled |
| kapua-a | ToManySecrets123# | true |
And Add permissions to the last created user
| domain | action |
| account | read |
| account | write |
And I logout
When I login as user with name "kapua-a" and password "ToManySecrets123#"
Given I select account "account-a"
Given I expect the exception "KapuaAccountException" with the text "A user cannot modify expiration date of the account in which it's defined"
When I change the current account expiration date to "null"
Then An exception was thrown
And I logout

Scenario: User cannot modify expiration date of the account in which it is defined - 2
A user defined inside an account cannot update the expiration date if its account.
In this test the user tries to change the expiration date from a "no expiration date" to a defined date.

When I login as user with name "kapua-sys" and password "kapua-password"
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 50 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 20 |
Given Account
| name | scopeId | expirationDate |
| account-a | 1 | null |
And I configure account service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 10 |
And I configure user service
| type | name | value |
| boolean | infiniteChildEntities | true |
| integer | maxNumberChildEntities | 5 |
And User A
| name | displayName | email | phoneNumber | status | userType |
| kapua-a | Kapua User A | kapua_a@kapua.com | +386 31 323 444 | ENABLED | INTERNAL |
And I add credentials
| name | password | enabled |
| kapua-a | ToManySecrets123# | true |
And Add permissions to the last created user
| domain | action |
| account | read |
| account | write |
And I logout
When I login as user with name "kapua-a" and password "ToManySecrets123#"
Given I select account "account-a"
Given I expect the exception "KapuaAccountException" with the text "A user cannot modify expiration date of the account in which it's defined"
When I change the current account expiration date to "20/11/1997"
Then An exception was thrown
And I logout

@teardown
Scenario: Reset Security Context for all scenarios
Given Reset Security Context
Given Reset Security Context
Expand Up @@ -19,9 +19,8 @@ Feature: REST API tests for User
REST API tests of Kapua CORS filter logic.

@setup
Scenario: Initialize Jaxb and security context, then start rest-api container and dependencies
Given Init Jaxb Context
And Init Security Context
Scenario: Initialize security context, then start rest-api container and dependencies
Given Init Security Context
#NB: be aware that sub-sequent tests depends on the value of cors endpoint refresh interval that you set here
And start rest-API container and dependencies with auth token TTL "6000"ms and refresh token TTL "20000"ms and cors endpoint refresh interval 1s

Expand Down Expand Up @@ -77,10 +76,10 @@ Feature: REST API tests for User
| name | password | enabled |
| user1 | ToManySecrets123# | true |
And Add permissions to the last created user
| domain | action |
| endpoint_info | read |
| endpoint_info | write |
| user | read |
| domain | action |
| endpoint_info | read |
| endpoint_info | write |
| user | read |
Then I logout
When REST POST call at "/v1/authentication/user" with JSON "{\"password\": \"ToManySecrets123#\", \"username\": \"user1\"}"
Then REST response code is 200
Expand Down

0 comments on commit ac91559

Please sign in to comment.