Skip to content

Commit

Permalink
Update generated test files
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Mar 15, 2024
1 parent 8e06a1a commit 2757da7
Show file tree
Hide file tree
Showing 6 changed files with 725 additions and 44 deletions.
690 changes: 688 additions & 2 deletions tests/outputs/apple-buy-a-mac.py

Large diffs are not rendered by default.

23 changes: 4 additions & 19 deletions tests/outputs/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ def t(self):
with self.rest(
"POST",
"/player/1/authenticate/testlogin",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"origin": "https://spela.test3.svenskaspel.se",
},
headers={"accept": "application/json, text/javascript, */*; q=0.01"},
json={"personalId": "193804122491", "source": 3},
) as resp:
pass
with self.rest(
"GET",
"/player/1/customizedsettings?_=1636025335990",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"origin": "https://spela.test3.svenskaspel.se",
},
headers={"accept": "application/json, text/javascript, */*; q=0.01"},
) as resp:
pass
with self.client.request(
Expand All @@ -51,22 +45,13 @@ def t(self):
) as resp:
pass
with self.rest(
"POST",
"/player/1/terms",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"origin": "https://spela.test3.svenskaspel.se",
},
json={},
"POST", "/player/1/terms", headers={"accept": "application/json, text/javascript, */*; q=0.01"}, json={}
) as resp:
pass
with self.rest(
"GET",
"/player/1/info?include=accountBalance&_=1636025343876",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"origin": "https://spela.test3.svenskaspel.se",
},
headers={"accept": "application/json, text/javascript, */*; q=0.01"},
) as resp:
pass

Expand Down
24 changes: 4 additions & 20 deletions tests/outputs/login_disable_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,15 @@ def t(self):
with self.client.request(
"POST",
"/player/1/authenticate/testlogin",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"content-type": "application/json",
"origin": "https://spela.test3.svenskaspel.se",
},
headers={"accept": "application/json, text/javascript, */*; q=0.01", "content-type": "application/json"},
data='{"personalId":"193804122491","source":3}',
catch_response=True,
) as resp:
pass
with self.client.request(
"GET",
"/player/1/customizedsettings?_=1636025335990",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"content-type": "text/plain",
"origin": "https://spela.test3.svenskaspel.se",
},
headers={"accept": "application/json, text/javascript, */*; q=0.01", "content-type": "text/plain"},
catch_response=True,
) as resp:
pass
Expand All @@ -57,23 +49,15 @@ def t(self):
with self.client.request(
"POST",
"/player/1/terms",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"content-type": "application/json",
"origin": "https://spela.test3.svenskaspel.se",
},
headers={"accept": "application/json, text/javascript, */*; q=0.01", "content-type": "application/json"},
data="{}",
catch_response=True,
) as resp:
pass
with self.client.request(
"GET",
"/player/1/info?include=accountBalance&_=1636025343876",
headers={
"accept": "application/json, text/javascript, */*; q=0.01",
"content-type": "text/plain",
"origin": "https://spela.test3.svenskaspel.se",
},
headers={"accept": "application/json, text/javascript, */*; q=0.01", "content-type": "text/plain"},
catch_response=True,
) as resp:
pass
Expand Down
16 changes: 15 additions & 1 deletion tests/outputs/login_plugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
from locust import run_single_user, task
from locust import events, run_single_user, task

import os

from locust_plugins.listeners import StopUserOnFail
from svs_locust import RestUser

os.environ["LOCUST_TEST_ENV"] = "itp1"
os.environ["LOCUST_TENANT"] = "lb"


@events.init.add_listener
def on_locust_init(environment, **_kwargs):
import time

environment.events.request.add_listener(lambda *args, **kw: time.sleep(0.1))
StopUserOnFail(environment)


class login(RestUser):
default_headers = {
Expand Down
1 change: 0 additions & 1 deletion tests/outputs/reqres.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class reqres_in(FastHttpUser):
"accept-language": "sv,en;q=0.9",
"cache-control": "no-cache",
"content-type": "application/json",
"origin": "https://reqres.in",
"pragma": "no-cache",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
}
Expand Down
15 changes: 14 additions & 1 deletion tests/outputs/reqres_plugin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
from locust import run_single_user, task
from locust import events, run_single_user, task

import os
import re

from locust_plugins.listeners import StopUserOnFail
from svs_locust import RestUser

os.environ["LOCUST_TEST_ENV"] = "itp1"
os.environ["LOCUST_TENANT"] = "lb"


@events.init.add_listener
def on_locust_init(environment, **_kwargs):
import time

environment.events.request.add_listener(lambda *args, **kw: time.sleep(0.1))
StopUserOnFail(environment)


class reqres_in(RestUser):
default_headers = {
Expand Down

0 comments on commit 2757da7

Please sign in to comment.