Beispiel #1
0
    def test_generate(self, uuid_func, time_func):
        uuid_func.return_value = 'uuid'
        time_func.return_value = 123.456

        id = Id.generate('typ')

        self.assertEqual(Id('id.typ.123.uuid'), id)
        self.assertEqual(hash(Id('id.typ.123.uuid')), hash(id))
        self.assertEqual('id.typ.123.uuid', str(id))
        self.assertEqual('id.typ.123.uuid', repr(id))
Beispiel #2
0
 def generate():
     return UserId(Id.generate_str('usr'))