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:])
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
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)
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))
def setUp(self): self.subject = IonSerializerDictionaryRepresentation(id_factory=SaltedTimeIDFactory())
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)