Subversion Repositories SmartDukaan

Rev

Rev 494 | Rev 3218 | 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
10
 
11
 
1504 ankur.sing 12
client = LogisticsClient().get_client()
442 rajveer 13
 
1504 ankur.sing 14
"""
494 rajveer 15
now = datetime.datetime.now()
16
test = now.hour
17
print test, now.hour
1504 ankur.sing 18
itemlogistics = client.getLogisticsEstimation(1, "332301")
472 rajveer 19
print itemlogistics.warehouseId
20
print itemlogistics.availability
21
print itemlogistics.shippingTime
1504 ankur.sing 22
"""
442 rajveer 23
 
477 rajveer 24
 
1504 ankur.sing 25
"""
26
The following test cases are to test if correct provider is being returned. For a destination pincode and a warehouse,
27
the provider mapping is defined in PyProj/src/samplesheets/Courier_Logic.xls
28
To check the output make modifications in the following function to print provider on the console.
29
PyProj/src/shop2020/logistics/service/impl/DataAccessor/get_logistics_estimation
30
"""
477 rajveer 31
 
1504 ankur.sing 32
# Item = 14 (<5000) Pincode = 125005 (Non-Local) serviced by Both, Provider = 1
33
# Item = 02 (>5000) Pincode = 125005 (Non-Local) serviced by Both, Provider = 1
34
# Item = 19 (=5000) Pincode = 123106 (Non-Local) serviced by AFL,  Provider = 2
35
# Item = 01 (>5000) Pincode = 123106 (Non-Local) serviced by AFL,  Provider = 2
36
# Item = 14 (<5000) Pincode = 834011 (Non-Local) serviced by AFL,  Provider = 2
37
# Item = 14 (<5000) Pincode = 854305 (Non-Local) serviced by BlueDart,  Provider = 1
38
# Item = 01 (>5000) Pincode = 854305 (Non-Local) serviced by BlueDart,  Provider = 1
442 rajveer 39
 
1504 ankur.sing 40
# Item = 03 (>5000) Pincode = 201301 (Local) serviced by Both, Provider = 1
41
# Item = 15 (<5000) Pincode = 201301 (Local) serviced by Both, Provider = 2
42
# Item = 04 (>5000) Pincode = 201307 (Local) serviced by Both,  Provider = 1
43
# Item = 19 (=5000) Pincode = 201307 (Local) serviced by Both,  Provider = 2
442 rajveer 44
 
45
 
1504 ankur.sing 46
client.getLogisticsEstimation(14, "125005") #Provider = 1
47
client.getLogisticsEstimation(02, "125005") #Provider = 1
48
client.getLogisticsEstimation(19, "123106") #Provider = 2
49
client.getLogisticsEstimation(01, "123106") #Provider = 2
50
client.getLogisticsEstimation(14, "834011") #Provider = 2
51
client.getLogisticsEstimation(14, "854305") #Provider = 1
52
client.getLogisticsEstimation(1, "854305") #Provider = 1
442 rajveer 53
 
1504 ankur.sing 54
client.getLogisticsEstimation(03, "201301") #Provider = 1
55
client.getLogisticsEstimation(15, "201301") #Provider = 2
56
client.getLogisticsEstimation(04, "201307") #Provider = 1
57
client.getLogisticsEstimation(19, "201307") #Provider = 2