Hi Everyone,
I’m facing one issue while running request library of framework.
I’m trying to GET request to one of our controller and we are saving our SESSION and the same SESSION we are using while doing POST request on the same controller for one Domain tab (there is a tab called a domain in the controller. I’m trying to do POST request on that.)
when I’m trying to do the POST request on the controller. It is again going to the sign-in page.
So to check the system persistence under domain creation, I have called the same SESSION which i created under login controller, which seems to be working as expected because I’m getting SESSION object value same under both the functions.
But while doing POST on Domain it’s going to sign in page.
If anyone knows the solution can please help.
Using BasicAuth authorisation.
Below is the code snippet:
*** Settings ***
Library Requests
Library Collections
Library String
*** Variables ***
${BASE_URL} http://10.49.182.127:3000 ${LOGIN_PATH} /administrators/sign_in ${USERNAME} root@adtran.com
${PASSWORD} blueblue
${SESSION_ALIAS} MySession
${DOMAIN_NAME} AALLEXXA
${DOMAIN_PATH} /platform/domains/ ${SESSION}
*** Test Cases ***
Initialize Session ${SESSION}= Create Session ${SESSION_ALIAS} ${BASE_URL} verify=${False} Set Global Variable ${SESSION} Log Session: ${SESSION}
Login to Controller
Log Session: ${SESSION}
${login_data}= Create Dictionary administrator[email]=${USERNAME} administrator[password]=${PASSWORD} ${response}= POST On Session ${SESSION} ${LOGIN_PATH} json=${login_data}
Should Be Equal As Numbers ${response.status_code} 200
Log Login successful
Create Domain
Log Session: ${SESSION}
Log Session Data: ${SESSION.cookies}
Log Domain started ${headers}= Create Dictionary Content-Type=application/json
${domain_data}= Create Dictionary domain[name]=${DOMAIN_NAME}
${response}= POST On Session ${SESSION} ${DOMAIN_PATH} json=${domain_data} headers=${headers}
Log Domain creation response: ${response.text} Should Be Equal As Numbers ${response.status_code} 200
Log Domain creation successful
Regards,
Shankar