-
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.
Merge pull request do Cristian Fabiano #1 from AndressaKarla/branch_c…
…ristian_user_login Adicionando e adaptando as principais partes de user_login do Cristian Fabiano
- Loading branch information
Showing
5 changed files
with
259 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
robotframework==6.1.1 | ||
robotframework-pythonlibcore==4.3.0 | ||
robotframework-faker==5.0.0 | ||
robotframework-requests==1.0a10 | ||
requests==2.31.0 | ||
python-dateutil==2.9.0.post0 |
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
203 changes: 203 additions & 0 deletions
203
resources/keywords/post_get_put_del_user_login_keyword.robot
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,203 @@ | ||
*** Settings *** | ||
Library RequestsLibrary | ||
Library String | ||
Library Collections | ||
Library FakerLibrary locale=pt_BR | ||
Library ../../resources/helpers.py | ||
Resource ../../resources/base.resource | ||
|
||
|
||
*** Variables *** | ||
${id_user} ${EMPTY} | ||
${email_vazio} ${EMPTY} | ||
${senha_vazio} ${EMPTY} | ||
${email_invalido} [email protected] | ||
${senha_invalida} 51@Test | ||
${user_mail} value | ||
|
||
|
||
*** Keywords *** | ||
Criar usuário | ||
${cpf} Gerar Cpf | ||
${mail} FakerLibrary.Email | ||
${Primeiro_nome} FakerLibrary.First Name | ||
${ultimo_nome} FakerLibrary.Last Name | ||
${fullName} Catenate ${Primeiro_nome} ${ultimo_nome} | ||
|
||
${body} Create Dictionary | ||
... fullName=${fullName} | ||
... mail=${mail} | ||
... password=${PASSWORD_CONFIRM_PASSWORD} | ||
... accessProfile=ADMIN | ||
... cpf=${cpf} | ||
... confirmPassword=${PASSWORD_CONFIRM_PASSWORD} | ||
|
||
Criar sessão | ||
|
||
${headers} Create Dictionary Authorization=${TOKEN_SYSADMIN} | ||
|
||
${resposta} POST On Session | ||
... alias=APIBlackList | ||
... url=/api/user | ||
... headers=${headers} | ||
... json=${body} | ||
... expected_status=201 | ||
|
||
Set Suite Variable ${novo_user} ${resposta.json()['user']['fullName']} | ||
Set Suite Variable ${user_mail} ${resposta.json()['user']['mail']} | ||
Set Suite Variable ${user_new_id} ${resposta.json()['user']['_id']} | ||
Set Suite Variable ${id_user} ${resposta.json()['user']['_id']} | ||
|
||
Log To Console \nnovo usuario | ||
Log To Console ${novo_user} | ||
Log ${novo_user} | ||
Log To Console novo email | ||
Log To Console ${user_mail} | ||
Log ${user_mail} | ||
|
||
Listar usuário | ||
Criar sessão | ||
|
||
${headers} Create Dictionary Authorization=${TOKEN_SYSADMIN} | ||
|
||
${resposta} GET On Session | ||
... alias=APIBlackList | ||
... url=/api/user/${id_user} | ||
... headers=${headers} | ||
... expected_status=200 | ||
|
||
Log ${resposta.json()} | ||
|
||
Alterar senha | ||
${body} Create Dictionary | ||
... password=${PASSWORD_CONFIRM_PASSWORD2} | ||
... confirmPassword=${PASSWORD_CONFIRM_PASSWORD2} | ||
|
||
Criar sessão | ||
|
||
${headers} Create Dictionary Authorization=${TOKEN_ADMIN} | ||
|
||
${resposta} PUT On Session | ||
... alias=APIBlackList | ||
... url=api/user/password/${id_user} | ||
... headers=${headers} | ||
... json=${body} | ||
... expected_status=200 | ||
|
||
Log ${resposta.json()} | ||
|
||
Should Be Equal As Strings ${resposta.json()['msg']} Senha atualizada com sucesso! | ||
|
||
Deletar usuário | ||
Criar sessão | ||
|
||
${headers} Create Dictionary Authorization=${TOKEN_ADMIN} | ||
|
||
${resposta} DELETE On Session | ||
... alias=APIBlackList | ||
... url=/api/user/${id_user} | ||
... headers=${headers} | ||
... expected_status=200 | ||
|
||
Log ${resposta.json()['msg']} | ||
|
||
Should Be Equal As Strings ${resposta.json()['msg']} Usuário deletado com sucesso!. | ||
|
||
Login campos vazios | ||
${body} Create Dictionary | ||
... mail=${email_vazio} | ||
... password=${senha_vazio} | ||
|
||
Criar sessão | ||
|
||
${resposta} POST On Session | ||
... alias=APIBlackList | ||
... url=api/login | ||
... json=${body} | ||
... expected_status=400 | ||
|
||
Log To Console \n${resposta} | ||
Log To Console ${resposta.json()['password']} | ||
Log To Console ${resposta.json()['mail']} | ||
Log ${resposta} | ||
Log ${resposta.json()['password']} | ||
Log ${resposta.json()['mail']} | ||
|
||
Should Be Equal As Strings ${resposta.json()['password']} O campo senha é obrigatório. | ||
Should Be Equal As Strings ${resposta.json()['mail']} O campo e-mail é obrigatório. | ||
|
||
#verificando session abertas | ||
|
||
${return} Session Exists alias=APIBlackList | ||
Log ${return} | ||
|
||
#deletando sessions abertas | ||
|
||
Delete All Sessions | ||
|
||
${return} Session Exists alias=APIBlackList | ||
Log ${return} | ||
|
||
Login email inválido | ||
${body} Create Dictionary | ||
... mail=${email_invalido} | ||
... password=${PASSWORD} | ||
|
||
Criar sessão | ||
|
||
${resposta} POST On Session | ||
... alias=APIBlackList | ||
... url=api/login | ||
... json=${body} | ||
... expected_status=400 | ||
|
||
Log To Console \n${resposta} | ||
Log To Console ${resposta.json()} | ||
Log ${resposta} | ||
Log ${resposta.json()} | ||
|
||
Should Be Equal As Strings ${resposta.json()['alert']} E-mail ou senha informados são inválidos. | ||
|
||
#verificando session abertas | ||
|
||
${return} Session Exists alias=APIBlackList | ||
Log ${return} | ||
|
||
#deletando sessions abertas | ||
|
||
Delete All Sessions | ||
|
||
${return} Session Exists alias=APIBlackList | ||
Log ${return} | ||
|
||
Login senha inválida | ||
${body} Create Dictionary | ||
... mail=${MAIL_ADMIN} | ||
... password=${senha_invalida} | ||
|
||
Criar sessão | ||
|
||
${resposta} POST On Session | ||
... alias=APIBlackList | ||
... url=api/login | ||
... json=${body} | ||
... expected_status=400 | ||
|
||
Log To Console \n${resposta} | ||
Log To Console ${resposta.json()} | ||
Log ${resposta} | ||
Log ${resposta.json()['alert']} | ||
|
||
Should Be Equal As Strings ${resposta.json()['alert']} E-mail ou senha informados são inválidos. | ||
|
||
#verificando session abertas | ||
|
||
${return} Session Exists alias=APIBlackList | ||
Log ${return} | ||
|
||
#deletando sessions abertas | ||
|
||
Delete All Sessions | ||
|
||
${return} Session Exists alias=APIBlackList | ||
Log ${return} |
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,49 @@ | ||
*** Settings *** | ||
Resource ../resources/keywords/post_get_put_del_user_login_keyword.robot | ||
|
||
|
||
*** Test Cases *** | ||
Criar usuário | ||
[Tags] post_user_admin regressao | ||
Obter dados user sydadmin estático | ||
POST login (SYSADMIN) e obter token mail=${MAIL_SYSADMIN} password=${PASSWORD} | ||
Obter password e confirmPassword estáticas user admin dinâmico | ||
Criar usuário | ||
|
||
Listar usuário | ||
[Tags] get_user_admin regressao | ||
Obter dados user sydadmin estático | ||
POST login (SYSADMIN) e obter token mail=${MAIL_SYSADMIN} password=${PASSWORD} | ||
Obter password e confirmPassword estáticas user admin dinâmico | ||
Criar usuário | ||
Listar usuário | ||
|
||
Alterar senha | ||
[Tags] put_password_user_admin regressao | ||
POST login (SYSADMIN), POST user (ADMIN), POST login (ADMIN) e obter tokens | ||
Obter password e confirmPassword estáticas user admin dinâmico | ||
Criar usuário | ||
Obter password e confirmPassword estáticas user admin dinâmico 2 | ||
Alterar senha | ||
|
||
Deletar usuário | ||
[Tags] del_user_admin regressao | ||
POST login (SYSADMIN), POST user (ADMIN), POST login (ADMIN) e obter tokens | ||
Obter password e confirmPassword estáticas user admin dinâmico | ||
Criar usuário | ||
Deletar usuário | ||
|
||
Validar tentativa de login campos vazios | ||
[Tags] login_campos_vazios | ||
Login campos vazios | ||
|
||
Validar tentativa de login email inválido | ||
[Tags] login_email_invalido | ||
Carregar user fixture | ||
Obter password user sysadmin estático | ||
Login email inválido | ||
|
||
Validar tentativa de login senha inválida | ||
[Tags] login_senha_invalida | ||
Gerar mail user admin dinâmico | ||
Login senha inválida |