Skip to content

Instantly share code, notes, and snippets.

@dubeyji10
Created July 25, 2022 12:18
Show Gist options
  • Save dubeyji10/e51b1d05f646161d8036066788ce3cc8 to your computer and use it in GitHub Desktop.
Save dubeyji10/e51b1d05f646161d8036066788ce3cc8 to your computer and use it in GitHub Desktop.
Testing user registration api call 1. Valid Credentials
import requests
import json
# https://www.ontestautomation.com/writing-tests-for-restful-apis-in-python-using-requests-part-1-basic-tests/
print('trying to create a user --')
#userDict = {
# 'username':'dubeyji213',
# 'password':'password213',
# 'role':'admin'
#}
#userDict = {
# 'username':'dubeyji218',
# 'password':'password218',
# 'role':'customer'
#}
userDict = {
'username':'dubeyji219',
'password':'password219',
'role':'admin'
}
print('user :',userDict)
print('making request')
#response = requests.post(url="http://localhost:8080/auth/post-test",data = userDict)
response = requests.post(url="http://localhost:8080/auth/register",data = userDict)
print("response : ",response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment