Ejemplo n.º 1
0
 def testpersist_moreunicode(self):
     domein = u'test'
     botskey = u'éëèêíïìîóöòõôúüùûáäàãâ\ufb52\ufb66\ufedb'
     botskey3 = u'ëéèõöóòñýÿÖÓÒÕ'
     value = u'éëèêíïìîóöòõôúüùûáäàãâ\ufb52\ufb66\ufedbñýÿÖÓÒÕ'
     value2 = u'ëéèõöóò'
     value3 = u'1/2/dñýÿÖÓÒÕ' * 3024
     transform.persist_delete(domein, botskey)
     transform.persist_delete(domein, botskey3)
     transform.persist_add(domein, botskey3, value3)
     self.assertEqual(value3, transform.persist_lookup(domein, botskey3),
                      'basis')
     transform.persist_add(domein, botskey, value)
     self.assertRaises(botslib.PersistError, transform.persist_add, domein,
                       botskey, value)  # is already present
     self.assertEqual(value, transform.persist_lookup(domein, botskey),
                      'basis')
     transform.persist_update(domein, botskey, value2)
     self.assertEqual(value2, transform.persist_lookup(domein, botskey),
                      'basis')
     #~ #self.assertRaises(botslib.PersistError,transform.persist_update,domein,botskey,value3)   #content is too long
     transform.persist_delete(domein, botskey)
     self.assertEqual(None, transform.persist_lookup(domein, botskey),
                      'basis')
     transform.persist_update(domein, botskey,
                              value)  # is not there. gives no error...
Ejemplo n.º 2
0
 def testpersist_unicode(self):
     domein = u'test'
     botskey = u'ëö1235:\ufb52\ufb66\ufedb'
     botskey3 = u'ëö135:\ufb52\ufb66\ufedb'
     value = u'xxxxxxxxxxxxxxxxx'
     value2 = u'IEFJUKAHE*FMhr\u0302\u0267t4hr f.wch shjeriw'
     value3 = u'1/2/d' * 3024
     transform.persist_delete(domein, botskey)
     transform.persist_delete(domein, botskey3)
     transform.persist_add(domein, botskey3, value3)
     self.assertEqual(value3, transform.persist_lookup(domein, botskey3),
                      'basis')
     transform.persist_add(domein, botskey, value)
     self.assertRaises(botslib.PersistError, transform.persist_add, domein,
                       botskey, value)  # is already present
     self.assertEqual(value, transform.persist_lookup(domein, botskey),
                      'basis')
     transform.persist_update(domein, botskey, value2)
     self.assertEqual(value2, transform.persist_lookup(domein, botskey),
                      'basis')
     # self.assertRaises(botslib.PersistError,transform.persist_update,domein,botskey,value3)   #content is too long
     transform.persist_delete(domein, botskey)
     self.assertEqual(None, transform.persist_lookup(domein, botskey),
                      'basis')
     transform.persist_update(domein, botskey,
                              value)  # is not there. gives no error...
Ejemplo n.º 3
0
 def testpersist_object(self):
     ''' use objects for pickling
     '''
     domein=u'test'
     botskey=u'éëèêíïìîóöòõôúüùûáäàãâ\ufb52\ufb66\ufedb'
     myobject = MyObject('a_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ','b_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ')
     myobject.d = '1_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ'
     myobject.e = 12345
     transform.persist_delete(domein,botskey)
     transform.persist_add(domein,botskey,myobject)
     self.assertEqual(myobject,transform.persist_lookup(domein,botskey),'basis')
Ejemplo n.º 4
0
 def testpersist_object(self):
     ''' use objects for pickling
     '''
     domein = u'test'
     botskey = u'éëèêíïìîóöòõôúüùûáäàãâ\ufb52\ufb66\ufedb'
     myobject = MyObject('a_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ',
                         'b_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ')
     myobject.d = '1_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ'
     myobject.e = 12345
     transform.persist_delete(domein, botskey)
     transform.persist_add(domein, botskey, myobject)
     self.assertEqual(myobject, transform.persist_lookup(domein, botskey),
                      'basis')
Ejemplo n.º 5
0
 def testpersist_object(self):
     """ use objects for pickling
     """
     domein = "test"
     botskey = "éëèêíïìîóöòõôúüùûáäàãâ\ufb52\ufb66\ufedb"
     myobject = MyObject("a_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ",
                         "b_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ")
     myobject.d = "1_éëèêíïìîóöòõôúüùûáäàãâñýÿÖÓÒÕ"
     myobject.e = 12345
     transform.persist_delete(domein, botskey)
     transform.persist_add(domein, botskey, myobject)
     self.assertEqual(myobject, transform.persist_lookup(domein, botskey),
                      "basis")
Ejemplo n.º 6
0
 def testpersistunicode(self):
     domein=u'test'
     botskey=u'1235:\ufb52\ufb66\ufedb'
     value= u'xxxxxxxxxxxxxxxxx'
     value2= u'IEFJUKAHE*FMhr\u0302\u0267t4hr f.wch shjeriw'
     value3= u'1'*1024
     transform.persist_delete(domein,botskey)
     #~ self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value3)   #content is too long
     transform.persist_add(domein,botskey,value)
     self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value)   #is already present
     self.assertEqual(value,transform.persist_lookup(domein,botskey),'basis')
     transform.persist_update(domein,botskey,value2)
     self.assertEqual(value2,transform.persist_lookup(domein,botskey),'basis')
     #~ self.assertRaises(botslib.PersistError,transform.persist_update,domein,botskey,value3)   #content is too long
     transform.persist_delete(domein,botskey)
     self.assertEqual(None,transform.persist_lookup(domein,botskey),'basis')
     transform.persist_update(domein,botskey,value)   #is not there. gives no error...
Ejemplo n.º 7
0
 def testpersist(self):
     #~ inn = inmessage.edifromfile(editype='edifact',messagetype='orderswithenvelope',filename='botssys/infile/tests/inisout02.edi')
     domein=u'test'
     botskey=u'test'
     value= u'xxxxxxxxxxxxxxxxx'
     value2= u'IEFJUKAHE*FMhrt4hr f.wch shjeriw'
     value3= u'1'*3024
     transform.persist_delete(domein,botskey)
     #~ self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value3)   #content is too long
     transform.persist_add(domein,botskey,value)
     self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value)   #is already present
     self.assertEqual(value,transform.persist_lookup(domein,botskey),'basis')
     transform.persist_update(domein,botskey,value2)
     self.assertEqual(value2,transform.persist_lookup(domein,botskey),'basis')
     #~ self.assertRaises(botslib.PersistError,transform.persist_update,domein,botskey,value3)   #content is too long
     transform.persist_delete(domein,botskey)
     self.assertEqual(None,transform.persist_lookup(domein,botskey),'basis')
     transform.persist_update(domein,botskey,value)   #test-tet is not there. gives no error...
Ejemplo n.º 8
0
 def testpersist_timestamp(self):
     # inn = inmessage.parse_edi_file(editype='edifact',messagetype='orderswithenvelope',filename='botssys/infile/tests/inisout02.edi')
     domein='test'
     botskey='timestamp'
     value= 'abcdedfgh'
     value2= 'IEFJUKAHE*FMhrt4hr f.wch shjeriw'
     value3= '1'*3024
     transform.persist_delete(domein,botskey)
     # self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value3)   #content is too long
     transform.persist_add(domein,botskey,value)
     ts1 = persist_lookup_ts(domein,botskey)
     time.sleep(1)
     self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value)   #is already present
     self.assertEqual(value,transform.persist_lookup(domein,botskey),'basis')
     transform.persist_update(domein,botskey,value2)
     self.assertEqual(value2,transform.persist_lookup(domein,botskey),'basis')
     ts2 = persist_lookup_ts(domein,botskey)
     print(ts1,ts2)
Ejemplo n.º 9
0
 def testpersist_moreunicode(self):
     domein=u'test'
     botskey=u'éëèêíïìîóöòõôúüùûáäàãâ\ufb52\ufb66\ufedb'
     botskey3=u'ëéèõöóòñýÿÖÓÒÕ'
     value= u'éëèêíïìîóöòõôúüùûáäàãâ\ufb52\ufb66\ufedbñýÿÖÓÒÕ'
     value2= u'ëéèõöóò'
     value3= u'1/2/dñýÿÖÓÒÕ'*3024
     transform.persist_delete(domein,botskey)
     transform.persist_delete(domein,botskey3)
     transform.persist_add(domein,botskey3,value3)
     self.assertEqual(value3,transform.persist_lookup(domein,botskey3),'basis')
     transform.persist_add(domein,botskey,value)
     self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value)   #is already present
     self.assertEqual(value,transform.persist_lookup(domein,botskey),'basis')
     transform.persist_update(domein,botskey,value2)
     self.assertEqual(value2,transform.persist_lookup(domein,botskey),'basis')
     #~ #self.assertRaises(botslib.PersistError,transform.persist_update,domein,botskey,value3)   #content is too long
     transform.persist_delete(domein,botskey)
     self.assertEqual(None,transform.persist_lookup(domein,botskey),'basis')
     transform.persist_update(domein,botskey,value)   #is not there. gives no error...
Ejemplo n.º 10
0
 def testpersist_timestamp(self):
     # inn = inmessage.parse_edi_file(editype='edifact',messagetype='orderswithenvelope',filename='botssys/infile/tests/inisout02.edi')
     domein = 'test'
     botskey = 'timestamp'
     value = 'abcdedfgh'
     value2 = 'IEFJUKAHE*FMhrt4hr f.wch shjeriw'
     value3 = '1' * 3024
     transform.persist_delete(domein, botskey)
     # self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value3)   #content is too long
     transform.persist_add(domein, botskey, value)
     ts1 = persist_lookup_ts(domein, botskey)
     time.sleep(1)
     self.assertRaises(botslib.PersistError, transform.persist_add, domein,
                       botskey, value)  # is already present
     self.assertEqual(value, transform.persist_lookup(domein, botskey),
                      'basis')
     transform.persist_update(domein, botskey, value2)
     self.assertEqual(value2, transform.persist_lookup(domein, botskey),
                      'basis')
     ts2 = persist_lookup_ts(domein, botskey)
     print(ts1, ts2)
Ejemplo n.º 11
0
 def testpersist(self):
     #~ inn = inmessage.edifromfile(editype='edifact',messagetype='orderswithenvelope',filename='botssys/infile/tests/inisout02.edi')
     domein = u'test'
     botskey = u'test'
     value = u'xxxxxxxxxxxxxxxxx'
     value2 = u'IEFJUKAHE*FMhrt4hr f.wch shjeriw'
     value3 = u'1' * 3024
     transform.persist_delete(domein, botskey)
     #~ self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value3)   #content is too long
     transform.persist_add(domein, botskey, value)
     self.assertRaises(botslib.PersistError, transform.persist_add, domein,
                       botskey, value)  #is already present
     self.assertEqual(value, transform.persist_lookup(domein, botskey),
                      'basis')
     transform.persist_update(domein, botskey, value2)
     self.assertEqual(value2, transform.persist_lookup(domein, botskey),
                      'basis')
     #~ self.assertRaises(botslib.PersistError,transform.persist_update,domein,botskey,value3)   #content is too long
     transform.persist_delete(domein, botskey)
     self.assertEqual(None, transform.persist_lookup(domein, botskey),
                      'basis')
     transform.persist_update(
         domein, botskey, value)  #test-tet is not there. gives no error...
Ejemplo n.º 12
0
 def testpersist_strings(self):
     # inn = inmessage.parse_edi_file(editype='edifact',messagetype='orderswithenvelope',filename='botssys/infile/tests/inisout02.edi')
     domein = "test"
     botskey = "test"
     value = "abcdedfgh"
     value2 = "IEFJUKAHE*FMhrt4hr f.wch shjeriw"
     value3 = "1" * 3024
     transform.persist_delete(domein, botskey)
     # self.assertRaises(botslib.PersistError,transform.persist_add,domein,botskey,value3)   #content is too long
     transform.persist_add(domein, botskey, value)
     self.assertRaises(botslib.PersistError, transform.persist_add, domein,
                       botskey, value)  # is already present
     self.assertEqual(value, transform.persist_lookup(domein, botskey),
                      "basis")
     transform.persist_update(domein, botskey, value2)
     self.assertEqual(value2, transform.persist_lookup(domein, botskey),
                      "basis")
     # self.assertRaises(botslib.PersistError,transform.persist_update,domein,botskey,value3)   #content is too long
     transform.persist_delete(domein, botskey)
     self.assertEqual(None, transform.persist_lookup(domein, botskey),
                      "basis")
     transform.persist_update(
         domein, botskey, value)  # test-tet is not there. gives no error...
Ejemplo n.º 13
0
def save_hdr_value(domain,key,value):
    try:
      transform.persist_add(domain,key,value)
    except: # this should not happen, but just in case...
      transform.persist_update(domain,key,value)