def test_partner_lookup(): for s in ['attr1','attr2','attr3','attr4','attr5']: if transform.partnerlookup('test',s) != s: raise Exception('test_partner_lookup') #test lookup for not existing partner idpartner = 'partner_not_there' if transform.partnerlookup(idpartner,'attr1',safe=True) != idpartner: raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner,'attr1') except botslib.CodeConversionError,e: pass
def test_partner_lookup(): for s in ['attr1', 'attr2', 'attr3', 'attr4', 'attr5']: if transform.partnerlookup('test', s) != s: raise Exception('test_partner_lookup') #test lookup for not existing partner idpartner = 'partner_not_there' if transform.partnerlookup(idpartner, 'attr1', safe=True) != idpartner: raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner, 'attr1') except botslib.CodeConversionError, e: pass
def test_partner_lookup(): for s in [ str('attr1'), str('attr2'), str('attr3'), str('attr4'), str('attr5') ]: if transform.partnerlookup('test', s) != s: raise Exception('test_partner_lookup') #test lookup for not existing partner idpartner = 'partner_not_there' if transform.partnerlookup(idpartner, 'attr1', safe=True) != idpartner: raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner, 'attr1') except botslib.CodeConversionError as msg: pass else: raise Exception('expect exception in test_partner_lookup') #test lookup where no value is in the database idpartner = 'test2' if transform.partnerlookup(idpartner, str('attr1')) != 'attr1': raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner, str('attr2')) except botslib.CodeConversionError as msg: pass else: raise Exception('expect exception in test_partner_lookup')
def test_partner_lookup(): for s in [str('attr1'),str('attr2'),str('attr3'),str('attr4'),str('attr5')]: if transform.partnerlookup('test',s) != s: raise Exception('test_partner_lookup') #test lookup for not existing partner idpartner = 'partner_not_there' if transform.partnerlookup(idpartner,'attr1',safe=True) != idpartner: raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner,'attr1') except botslib.CodeConversionError as msg: pass else: raise Exception('expect exception in test_partner_lookup') #test lookup where no value is in the database idpartner = 'test2' if transform.partnerlookup(idpartner,str('attr1')) != 'attr1': raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner,str('attr2')) except botslib.CodeConversionError as msg: pass else: raise Exception('expect exception in test_partner_lookup')
if transform.partnerlookup('test',s) != s: raise Exception('test_partner_lookup') #test lookup for not existing partner idpartner = 'partner_not_there' if transform.partnerlookup(idpartner,'attr1',safe=True) != idpartner: raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner,'attr1') except botslib.CodeConversionError,e: pass else: raise Exception('expect exception in test_partner_lookup') #test lookup where no value is in the database idpartner = 'test2' if transform.partnerlookup(idpartner,'attr1') != 'attr1': raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner,'attr2') except botslib.CodeConversionError,e: pass else: raise Exception('expect exception in test_partner_lookup') def grammartest(l,expect_error=True): if expect_error: if not subprocess.call(l): raise Exception('grammartest: expected error, but no error') else: if subprocess.call(l): raise Exception('grammartest: expected no error, but received an error')
def party_mapping(inn, shipment): #loop over partys (all on shipment level for simplicity ;-) for party in inn.getloop({'BOTSID': 'message'}, {'BOTSID': 'partys'}, {'BOTSID': 'party'}): pou = shipment.putloop({'BOTSID': 'HL'}, {'BOTSID': 'N1'}) pou.put({ 'BOTSID': 'N1', 'N101': party.get({ 'BOTSID': 'party', 'qual': None }) }) #write partyID: if gln write it, else DUNS etc #this uses the fact the out.put returns True if succeeded. if pou.put({ 'BOTSID': 'N1', 'N103': 'UL', 'N104': party.get({ 'BOTSID': 'party', 'gln': None }) }): pass elif pou.put({ 'BOTSID': 'N1', 'N103': '1', 'N104': party.get({ 'BOTSID': 'party', 'DUNS': None }) }): pass elif pou.put({ 'BOTSID': 'N1', 'N103': '92', 'N104': party.get({ 'BOTSID': 'party', 'externalID': None }) }): pass else: pou.put({ 'BOTSID': 'N1', 'N103': '91', 'N104': party.get({ 'BOTSID': 'party', 'internalID': None }) }) pou.put({ 'BOTSID': 'N1', 'N102': party.get({ 'BOTSID': 'party', 'name1': None }) }) pou.put({'BOTSID': 'N1'}, { 'BOTSID': 'N2', 'N201': party.get({ 'BOTSID': 'party', 'name2': None }) }) pou.put({'BOTSID': 'N1'}, { 'BOTSID': 'N3', 'N301': party.get({ 'BOTSID': 'party', 'address1': None }) }) pou.put({'BOTSID': 'N1'}, { 'BOTSID': 'N3', 'N302': party.get({ 'BOTSID': 'party', 'address2': None }) }) pou.put({'BOTSID': 'N1'}, { 'BOTSID': 'N4', 'N401': party.get({ 'BOTSID': 'party', 'city': None }) }) pou.put({'BOTSID': 'N1'}, { 'BOTSID': 'N4', 'N402': party.get({ 'BOTSID': 'party', 'state': None }) }) pou.put({'BOTSID': 'N1'}, { 'BOTSID': 'N4', 'N403': party.get({ 'BOTSID': 'party', 'pcode': None }) }) pou.put({'BOTSID': 'N1'}, { 'BOTSID': 'N4', 'N404': party.get({ 'BOTSID': 'party', 'country': None }) }) #PARTNER LOOKUP *** sometimes there is no 'BY' qualifier in xml inhouse message. This is fixed here if not inn.get({'BOTSID': 'message'}, {'BOTSID': 'partys'}, { 'BOTSID': 'party', 'qual': 'BY' }): pou = shipment.putloop({'BOTSID': 'HL'}, {'BOTSID': 'N1'}) #do a lookup for values in partner pou.put({ 'BOTSID': 'N1', 'N101': 'BY', 'N102': transform.partnerlookup(inn.ta_info['topartner'], 'attr1') }) pou.put({ 'BOTSID': 'N1', 'N103': '92', 'N104': transform.partnerlookup(inn.ta_info['topartner'], 'name') })
if transform.partnerlookup('test', s) != s: raise Exception('test_partner_lookup') #test lookup for not existing partner idpartner = 'partner_not_there' if transform.partnerlookup(idpartner, 'attr1', safe=True) != idpartner: raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner, 'attr1') except botslib.CodeConversionError, e: pass else: raise Exception('expect exception in test_partner_lookup') #test lookup where no value is in the database idpartner = 'test2' if transform.partnerlookup(idpartner, 'attr1') != 'attr1': raise Exception('test_partner_lookup') try: transform.partnerlookup(idpartner, 'attr2') except botslib.CodeConversionError, e: pass else: raise Exception('expect exception in test_partner_lookup') def grammartest(l, expect_error=True): if expect_error: if not subprocess.call(l): raise Exception('grammartest: expected error, but no error') else: if subprocess.call(l):