Subversion Repositories SmartDukaan

Rev

Rev 1504 | Rev 4439 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
442 rajveer 1
'''
2
Created on 13-Sep-2010
3
 
4
@author: rajveer
5
'''
6
 
7
from shop2020.clients.LogisticsClient import LogisticsClient
8
from shop2020.thriftpy.logistics.ttypes import *
9
import datetime
3218 rajveer 10
from shop2020.logistics.service.impl.DataService import DeliveryEstimate
442 rajveer 11
 
12
 
1504 ankur.sing 13
client = LogisticsClient().get_client()
442 rajveer 14
 
1504 ankur.sing 15
"""
494 rajveer 16
now = datetime.datetime.now()
17
test = now.hour
18
print test, now.hour
1504 ankur.sing 19
itemlogistics = client.getLogisticsEstimation(1, "332301")
472 rajveer 20
print itemlogistics.warehouseId
21
print itemlogistics.availability
22
print itemlogistics.shippingTime
1504 ankur.sing 23
"""
442 rajveer 24
 
477 rajveer 25
 
1504 ankur.sing 26
"""
27
The following test cases are to test if correct provider is being returned. For a destination pincode and a warehouse,
28
the provider mapping is defined in PyProj/src/samplesheets/Courier_Logic.xls
29
To check the output make modifications in the following function to print provider on the console.
30
PyProj/src/shop2020/logistics/service/impl/DataAccessor/get_logistics_estimation
31
"""
477 rajveer 32
 
1504 ankur.sing 33
# Item = 14 (<5000) Pincode = 125005 (Non-Local) serviced by Both, Provider = 1
34
# Item = 02 (>5000) Pincode = 125005 (Non-Local) serviced by Both, Provider = 1
35
# Item = 19 (=5000) Pincode = 123106 (Non-Local) serviced by AFL,  Provider = 2
36
# Item = 01 (>5000) Pincode = 123106 (Non-Local) serviced by AFL,  Provider = 2
37
# Item = 14 (<5000) Pincode = 834011 (Non-Local) serviced by AFL,  Provider = 2
38
# Item = 14 (<5000) Pincode = 854305 (Non-Local) serviced by BlueDart,  Provider = 1
39
# Item = 01 (>5000) Pincode = 854305 (Non-Local) serviced by BlueDart,  Provider = 1
442 rajveer 40
 
1504 ankur.sing 41
# Item = 03 (>5000) Pincode = 201301 (Local) serviced by Both, Provider = 1
42
# Item = 15 (<5000) Pincode = 201301 (Local) serviced by Both, Provider = 2
43
# Item = 04 (>5000) Pincode = 201307 (Local) serviced by Both,  Provider = 1
44
# Item = 19 (=5000) Pincode = 201307 (Local) serviced by Both,  Provider = 2
442 rajveer 45
 
46
 
3218 rajveer 47
print client.getLogisticsEstimation(14, "201301") #Provider = 1
48
print client.getLogisticsEstimation(14, "332001") #Provider = 1
49
print client.isCodAllowed("201301")
50
print client.isCodAllowed("3")
51
print client.getDestinationCode(1, "201301")
52
print client.getDestinationCode(1, "332001")
442 rajveer 53
 
3218 rajveer 54
#client.getLogisticsEstimation(02, "125005") #Provider = 1
55
#client.getLogisticsEstimation(19, "123106") #Provider = 2
56
#client.getLogisticsEstimation(01, "123106") #Provider = 2
57
#client.getLogisticsEstimation(14, "834011") #Provider = 2
58
#client.getLogisticsEstimation(14, "854305") #Provider = 1
59
#client.getLogisticsEstimation(1, "854305") #Provider = 1
60
#
61
#client.getLogisticsEstimation(03, "201301") #Provider = 1
62
#client.getLogisticsEstimation(15, "201301") #Provider = 2
63
#client.getLogisticsEstimation(04, "201307") #Provider = 1
64
#client.getLogisticsEstimation(19, "201307") #Provider = 2