def test_put_student_byId(): tut = a.tutorantId() url = a.api_link() + "student/" + tut payload = "{\n\"studentID\": " + a.tutorantId( ) + " ,\n \"firstName\": \"TestCoach+1\",\n \"surName\": \"Test\",\n \"phoneNumber\": \"0692495724\",\n \"interests\": \"Programming (C only), Servers, Cisco\",\n \"photo\": \"https://i.imgur.com/Tl5sYD6.jpg\",\n \"description\": \"I am a coach\",\n \"degree\": \"HBO\",\n \"study\": \"Technische Informatica\",\n \"studyYear\": 4\n}" headers = {'Content-Type': "application/json", 'cache-control': "no-cache"} r = requests.put(url, data=payload, headers=headers) assert r.status_code == 204, r.status_code
def test_post_tutorant(): a.delete_tutorant(a.tutorantId()) url = a.api_link() + "profile/tutorant" payload = "{\n \"user\": {\n \"studentID\": \"" + a.tutorantId( ) + "\",\n \"firstName\": \"TestTutorant\",\n \"surName\": \"Test\",\n \"phoneNumber\": \"0692495724\",\n \"interests\": \"Programming (C only), Servers, Cisco\",\n \"photo\": \"https://i.imgur.com/Tl5sYD6.jpg\",\n \"description\": \"I am a student\",\n \"degree\": \"HBO\",\n \"study\": \"Technische Informatica\",\n \"studyYear\": 4\n }, \n \"tutorant\": {\n \"studentID\": \"" + a.tutorantId( ) + "\"\n } \n}" headers = {'Content-Type': "application/json", 'cache-control': "no-cache"} r = requests.request("POST", url, data=payload, headers=headers) if r.status_code is not 201: a.create_tutorant(a.tutorantId()) assert r.status_code == 201, r.status_code
def test_get_tutorant_byId(): r = requests.get(a.api_link() + "profile/tutorant/" + a.tutorantId()) assert r.status_code == 200, r.status_code v = Validator(a.s_tutorant()) assert v.validate(r.json()['tutorant']) == True, v.errors v = Validator(a.s_studentData()) assert v.validate(r.json()['user']) == True, v.errors
def test_put_coachTutorant_tutorant_byId(): tut = a.tutorantId() url = a.api_link() + "coachTutorant" payload = "{\n\"studentIDTutorant\":\""+ tut +"\",\n\"studentIDCoach\": \""+ a.coachId() +"\",\n\"status\":\"Completed\"\n}" headers = { 'Content-Type': "application/json", 'cache-control': "no-cache"} r = requests.put(url, data=payload, headers=headers) assert r.status_code == 204, r.status_code
def test_post_coachTutorant(): tut = a.tutorantId() a.delete_coachTutorant(tut) url = a.api_link() + "coachTutorant/tutorant/" + tut payload = "{\n\"studentIDTutorant\":\""+ tut +"\",\n\"studentIDCoach\": \""+ a.coachId() +"\",\n\"status\":\"Pending\"\n}" headers = { 'Content-Type': "application/json", 'cache-control': "no-cache"} r = requests.post(url, data=payload, headers=headers) if r.status_code is not 201: a.create_coachTutorant(tut) assert r.status_code == 201, r.status_code
def test_get_messages_coachId_tutorantId(): params = {"amountOfMessages": 20} r = requests.get(a.api_link() + "messages/" + a.coachId() + "/" + a.tutorantId(), params=params) assert r.status_code == 200, r.status_code
def test_delete_coachTutorant_tutorant_byId(): r = requests.delete(a.api_link() + "coachTutorant/tutorant/" + a.tutorantId()) if r.status_code is not 204: a.create_coachTutorant(a.tutorantId()) assert r.status_code == 204, r.status_code a.create_coachTutorant(a.tutorantId())
def test_get_coachTutorant_tutorant_byId(): r = requests.get(a.api_link() + "coachTutorant/tutorant/" + a.tutorantId()) assert r.status_code == 200, r.status_code v = Validator(a.s_coachTutorant()) assert v.validate(r.json()) == True, v.errors
def test_delete_tutorant_byId(): r = requests.delete(a.api_link() + "profile/tutorant/" + a.tutorantId()) assert r.status_code == 204, r.status_code a.create_tutorant(a.tutorantId())