Skip to content
Snippets Groups Projects
Commit 51149557 authored by Ján Macháček's avatar Ján Macháček
Browse files

scenario - admin user tasks

parent 5838679d
No related branches found
No related tags found
No related merge requests found
......@@ -51,23 +51,53 @@ class Admin(HttpUser):
})
@task
def create_airplane_type(self):
self.client.post(":8080/api/airplaneTypes", json=
def create_airplane(self):
response = self.client.get(":8080/api/airplaneTypes/1")
if response.status_code == 200:
self.client.post(":8080/api/airplanes", json=
{
"name": "Prášek",
"capacity": 2,
"airplaneTypeId": 1
})
@task
def create_steward(self):
self.client.post(":8080/api/stewards", json=
{
"name": "Práškovač 3000"
"firstName": "John",
"lastName": "Doe"
})
return
@task
def create_airplane(self):
self.client.get(":8080/api/airplaneTypes")
self.client.post(":8080/api/airplanes", json=
@task
def create_flight(self):
self.client.post(":8080/api/flights", json=
{
"name": "Prášek",
"capacity": 2,
"airplaneTypeId": 1
"departureTime": "2022-12-22T12:04:04.493908908+01:00",
"arrivalTime": "2022-12-22T12:04:04.493908908+01:00"
})
self.client.get(":8080/api/airplanes")
@task
def assign_steward_flight(self):
response_steward = self.client.get(":8080/api/stewards/1")
response_flight = self.client.get(":8080/api/flights/1")
if response_steward.status_code == 200 and response_flight.status_code == 200:
self.client.post(":8080/api/stewards/1/flights/1")
self.client.delete(":8080/api/stewards/1/flights/1")
@task
def assign_airport_flight(self):
response_airport1 = self.client.get(":8080/api/airports/1")
response_airport2 = self.client.get(":8080/api/airports/2")
response_flight = self.client.get(":8080/api/flights/1")
if response_airport1.status_code == 200 and response_flight.status_code == 200 and response_airport2.status_code == 200:
self.client.post(":8080/api/airports/1/departingFlights/1")
self.client.post(":8080/api/airports/2/arrivingFlights/1")
self.client.delete(":8080/api/airports/1/departingFlights/1")
self.client.delete(":8080/api/airports/2/arrivingFlights/1")
class BasicUser(HttpUser):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment