forked from bkorban/api-testing-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_utils.py
41 lines (30 loc) · 883 Bytes
/
test_utils.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
from datetime import timedelta
from time import time
from logger import Logger
def decorate_test(test_function):
def wrapper():
Logger.log_test_start(test_function)
time_delta, _ = measure_time(test_function)
Logger.log_test_finish(test_function, timedelta(seconds=time_delta))
return wrapper
def measure_time(function):
start = time()
result = function()
end = time()
return end - start, result
class Constants:
bookingid: 'bookingid'
booking: 'booking'
firstname: 'firstname'
lastname: 'lastname'
totalprice: 'totalprice'
depositpaid: 'depositpaid'
bookingdates: 'bookingdates'
checkin: 'checkin'
checkout: 'checkout'
additionalneeds: 'additionalneeds'
class DataModel:
bookings_data_length = None
class RequestParams:
booking_ID_key = 'bookingid',
booking_ID_value = 1