-
Notifications
You must be signed in to change notification settings - Fork 0
/
locustfile.py
91 lines (77 loc) · 3.72 KB
/
locustfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from locust import HttpLocust, TaskSet, task
from providers.cpsProviders import Providers as cps
import utility
import json
import pinpad_message as pinpad
from tests.common.customRequests import Requests as requests
from tests.correct.locustWebStickers import LocustWebStickers as webStickers
from tests.correct.locustAlcs import LocustAlcs as alcsRequests
from tests.correct.locustBOK import LocustBOK as bokRequests
import time
from random import randint
#import response.webSticker.responses as webResp
class UserBehavior(TaskSet):
#c = open('card', 'r+')
#cards = c.read().splitlines()
#c.close()
#h = open('hmac', 'r+')
#hmacs = h.read().splitlines()
#h.close()
counterStart = 999001035000
counter = 999001035000
#cardNumber = counter * 10
@task
def test1(self):
#rand = randint(7950000000000,7950000999999)
#for i in range(1000):
#bokRequests.changePassword(self, str(rand))
#cardNumber = alcsRequests.registerClient(self)[0]
# sessionId = bokRequests.changePassword(self, '7157834569333')
UserBehavior.counter += 1
cardNumber = UserBehavior.counter * 10
if UserBehavior.counter - UserBehavior.counterStart >= 9999:
UserBehavior.counter = UserBehavior.counterStart
#print(cardNumber)
phoneNumber, activationToken , CustomerGuid = webStickers.registerClient(self)
formattedPhoneNumber = '-'.join((phoneNumber[2:5],phoneNumber[5:8],phoneNumber[8:]))
webStickers.activateCustomer(self, str(activationToken), "1234")
try:
LoyaltyCardIssueId = webStickers.ALCSRegisterCustomer(self, "9990004716100","123456","99","312")
LoyaltyCardIssueId1, PosActionId = webStickers.ALCSRegisterCustomerStepTwo(self, "9990004716100", LoyaltyCardIssueId)
posacId1 = webStickers.ALCSRegisterCustomerReset(self, "9990004716100", LoyaltyCardIssueId1, PosActionId)
posacId2 = webStickers.ALCSRegisterCustomerMessage(self, "9990004716100", LoyaltyCardIssueId1, posacId1)
posacId3 = webStickers.ALCSRegisterCustomerConfirmPhoneNumber(self, "9990004716100", LoyaltyCardIssueId1, posacId2, pinpad(formattedPhoneNumber))
posacId4 = webStickers.ALCSRegisterCustomerMessage(self, "9990004716100", LoyaltyCardIssueId1, posacId3)
posacId5 = webStickers.ALCSRegisterCustomerConfirmPhoneNumber(self, "9990004716100", LoyaltyCardIssueId1, posacId4, pinpad("0000"))
webStickers.ALCSCommitRegisterCustomer(self, "9990004716100", LoyaltyCardIssueId1)
except Exception as e:
print("Error: %s" % str(e))
#print (pinpad.createMessage(formattedPhoneNumber) + " " + formattedPhoneNumber + " " + activationToken +" " + CustomerGuid)
sessionId = webStickers.login(self, cardNumber)["SessionId"]
if (str(sessionId) != str(-1)):
#print(sessionId)
#webStickers.changePassword(self, sessionId, cardNumber)
# time.sleep(1)
ifMatch, phoneNumberGet = webStickers.getCustomer(self, sessionId)
phoneNumberPatch, newIfMatch = webStickers.changeClientData(self, sessionId, ifMatch)
webStickers.changePassword(self, sessionId)
webStickers.logout(self, sessionId)
#patchTime = time.strftime("[%d/%b/%Y:%H:%M:%S +0200]", time.localtime())
#f = open(str(UserBehavior.counterStart) + ".log", "a+")
#f.write(patchTime + " CardNumber: " + str(cardNumber) + " Old: " + str(phoneNumberGet) + " New: " + str(phoneNumberPatch) + "\n")
#f.close()
#webStickers.logout(self, sessionId)
#else:
#print(cardNumber, sessionId)
#time.sleep(2)
#ifMatch = webStickers.getCustomer(self, sessionId)
#print (ifMatch)
#webStickers.changePassword(self, sessionId, cardNumber)
#webStickers.changeClientData(self, ifMatch)
#alcsRequests.activateClient(self)
#webStickers.getClientName(self, sessionId)
#webStickers.logout(self, sessionId)
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=1000
max_wait=5000