test_sate24.py
1.09 KB
import sate24
def test_parsePullMessage():
task = sate24.parsePullMessage('NONE')
assert task['status'] == 'NONE'
task = sate24.parsePullMessage('OK;181380;181359;20150323155308;02199994004;ADHISIMON;aaa_pull;E5;DKI_JAKARTA;0;;')
assert task['status'] == 'OK'
assert task['requestId'] == '181380'
assert task['timestamp'] == '20150323155308'
assert task['destination'] == '02199994004'
assert task['member'] == 'ADHISIMON'
assert task['gateway_type'] == 'aaa_pull'
assert task['product'] == 'E5'
assert task['city'] == 'DKI_JAKARTA'
def test_keyByRequestId():
assert sate24.keyByRequestId('TEST', '123') == 'TEST.trx.requestId:123'
def test_keyByNominalDestination():
assert sate24.keyByNominalDestination('TEST', '5000', '08180818') == 'TEST.trx.nominal:5000.destination:08180818'
def test_removeProduct():
assert sate24.removeProduct('XL5,XL10', 'XL5') == 'XL10'
assert sate24.removeProduct('XL5,XL10', 'XL10') == 'XL5'
assert sate24.removeProduct('XL10', 'XL10') == ''
assert sate24.removeProduct('XL5,XL10', 'XL50') == 'XL5,XL10'