Skip to content

Commit

Permalink
Add support for string ids (guids)
Browse files Browse the repository at this point in the history
Add support for string ids (guids)
  • Loading branch information
kPsarakis committed Jun 1, 2020
2 parents 787b744 + 1068a75 commit 86379ed
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions locustfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class LoadTest1(TaskSequence):
"""
Scenario where a stock admin creates an item and adds stock to it
"""
item_ids: List[int]
item_ids: List[str]

def on_start(self):
""" on_start is called when a Locust start before any task is scheduled """
Expand All @@ -110,19 +110,19 @@ class LoadTest2(TaskSequence):
"""
Scenario where a user checks out an order with one item inside that an admin has added stock to before
"""
item_ids: List[int]
user_id: int
order_id: int
item_ids: List[str]
user_id: str
order_id: str

def on_start(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

def on_stop(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

@seq_task(1)
def admin_creates_item(self): create_item(self)
Expand Down Expand Up @@ -150,19 +150,19 @@ class LoadTest3(TaskSequence):
"""
Scenario where a user checks out an order with two items inside that an admin has added stock to before
"""
item_ids: List[int]
user_id: int
order_id: int
item_ids: List[str]
user_id: str
order_id: str

def on_start(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

def on_stop(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

@seq_task(1)
def admin_creates_item1(self): create_item(self)
Expand Down Expand Up @@ -199,19 +199,19 @@ class LoadTest4(TaskSequence):
"""
Scenario where a user adds an item to an order, regrets it and removes it and then adds it back and checks out
"""
item_ids: List[int]
user_id: int
order_id: int
item_ids: List[str]
user_id: str
order_id: str

def on_start(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

def on_stop(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

@seq_task(1)
def admin_creates_item(self): create_item(self)
Expand Down Expand Up @@ -245,19 +245,19 @@ class LoadTest5(TaskSequence):
"""
Scenario that is supposed to fail because the second item does not have enough stock
"""
item_ids: List[int]
user_id: int
order_id: int
item_ids: List[str]
user_id: str
order_id: str

def on_start(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

def on_stop(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

@seq_task(1)
def admin_creates_item1(self): create_item(self)
Expand Down Expand Up @@ -297,19 +297,19 @@ class LoadTest6(TaskSequence):
"""
Scenario that is supposed to fail because the user does not have enough credit
"""
item_ids: List[int]
user_id: int
order_id: int
item_ids: List[str]
user_id: str
order_id: str

def on_start(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

def on_stop(self):
self.item_ids = list()
self.user_id = -1
self.order_id = -1
self.user_id = ""
self.order_id = ""

@seq_task(1)
def admin_creates_item(self): create_item(self)
Expand Down

0 comments on commit 86379ed

Please sign in to comment.