Example #1
0
 def test_change_salt(self):
     # use unusually large salt to make it
     # nearly impossible 2 random salts will be equal
     subject = SaltedTimeIDFactory(salt_chars=10)
     id1 = subject.create_id()
     id2 = subject.replace_duplicate()
     self.assertTrue(id1[-10:]!=id2[-10:])
Example #2
0
 def test_increasing(self):
     subject = SaltedTimeIDFactory()
     id1 = subject.create_id()
     for n in xrange(20):
         id2 = subject.create_id()
         self.assertTrue(id2>id1, msg='%s v %s'%(id1,id2))
         id1=id2
Example #3
0
 def __init__(self, pools, representation=None):
     self._pool = pools
     if representation:
         self._representation = representation
     else:
         self._id_factory = SaltedTimeIDFactory()
         self._representation = IonSerializerDictionaryRepresentation(id_factory=self._id_factory)
Example #4
0
    def test_length(self):
        subject = SaltedTimeIDFactory()
        id = subject.create_id()
        self.assertEqual(10, len(id))

        sub2 = SaltedTimeIDFactory(salt_chars=5)
        id = sub2.create_id()
        self.assertEqual(12, len(id))
Example #5
0
 def setUp(self):
     self.subject = IonSerializerDictionaryRepresentation(id_factory=SaltedTimeIDFactory())
Example #6
0
 def setUp(self):
     raise SkipTest("Skip until test works with non-localhost")
     id_factory = SaltedTimeIDFactory()
     self.pools = CouchDBPoolDict(prefix='testcouchstore'+id_factory.create_id().lower(), can_create=True, must_create=True)
     self.repo = Repository(self.pools)