-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a28efa
commit 4bb8b93
Showing
6 changed files
with
145 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Feature: Login | ||
In order to use the application | ||
As a user | ||
I want to be able to login | ||
|
||
Background: | ||
Scenario: Register with valid credentials | ||
Given a POST request to "/api/v1/Auth/register" with body | ||
""" | ||
{ | ||
"username": "login1", | ||
"email": "[email protected]", | ||
"password": "#aD3fe2.0%", | ||
"repeatPassword": "#aD3fe2.0%" | ||
} | ||
""" | ||
Then the response status code should be 201 | ||
Then the response body should be empty | ||
|
||
|
||
Scenario: Login with valid credentials | ||
Given a POST request to "/api/v1/Auth/login" with body | ||
""" | ||
{ | ||
"email": "[email protected]", | ||
"password": "#aD3fe2.0%" | ||
} | ||
""" | ||
Then the response status code should be 200 | ||
Then the response body should include an auth token | ||
|
||
Scenario: Fail with invalid credentials | ||
Given a POST request to "/api/v1/Auth/login" with body | ||
""" | ||
{ | ||
"email": "[email protected]", | ||
"password": "#aDXXXXXXX3fe2.0%" | ||
} | ||
""" | ||
Then the response status code should be 401 | ||
Then the response body should be | ||
""" | ||
{ | ||
"message": "Invalid credentials" | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
Feature: Register a new user | ||
In order to use the application | ||
I want to register a new user | ||
|
||
Scenario: Register a valid user | ||
Given a POST request to "/api/v1/Auth/register" with body | ||
""" | ||
{ | ||
"username": "register1", | ||
"email": "[email protected]", | ||
"password": "#aD3fe2.0%", | ||
"repeatPassword": "#aD3fe2.0%" | ||
} | ||
""" | ||
Then the response status code should be 201 | ||
Then the response body should be empty | ||
|
||
Scenario: Existing email | ||
Given a POST request to "/api/v1/Auth/register" with body | ||
""" | ||
{ | ||
"username": "register", | ||
"email": "[email protected]", | ||
"password": "#aD3fe2.0%", | ||
"repeatPassword": "#aD3fe2.0%" | ||
} | ||
""" | ||
Then the response status code should be 400 | ||
Then the response body should be | ||
""" | ||
{ | ||
"message": "User <[email protected]> already exists" | ||
} | ||
""" | ||
|
||
Scenario: Password and repeat password are different | ||
Given a POST request to "/api/v1/Auth/register" with body | ||
""" | ||
{ | ||
"username": "register", | ||
"email": "[email protected]", | ||
"password": "#aD3fe2.0%", | ||
"repeatPassword": "#aD3fe2.0%1" | ||
} | ||
""" | ||
Then the response status code should be 400 | ||
Then the response body should be | ||
""" | ||
{ | ||
"errors": [ | ||
{ | ||
"repeatPassword": "Passwords do not match at body." | ||
} | ||
] | ||
} | ||
""" | ||
|
||
Scenario: Invalid arguments | ||
Given a POST request to "/api/v1/Auth/register" with body | ||
""" | ||
{ | ||
"email": "aaJaa", | ||
"password": "1234", | ||
"repeatPassword": "1234" | ||
} | ||
""" | ||
Then the response status code should be 400 | ||
Then the response body should be | ||
""" | ||
{ | ||
"errors": [ | ||
{ | ||
"email": "Invalid value at body. Value: aaJaa" | ||
}, | ||
{ | ||
"username": "Invalid value at body. Value: undefined" | ||
}, | ||
{ | ||
"password": "Invalid value at body." | ||
}, | ||
{ | ||
"repeatPassword": "Invalid value at body." | ||
} | ||
] | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters