Example #1
0
 def test_snowflake_time_is_1_and_epoch_is_0_and_datacenterid_is_1(
         self, time):
     time.return_value = 1
     epoch = 0
     guid = SnowFlake(1, 0, epoch)
     guoidvalue = guid.next()
     self.assertEqual(4194435072, guoidvalue)
Example #2
0
 def test_snowflake_time_is_1_and_epoch_is_0_and_workerid_1(self, time):
     time.return_value = 1
     epoch = 0
     guid = SnowFlake(0, 1, epoch)
     guoidvalue = guid.next()
     self.assertEqual(4194308096, guoidvalue)
Example #3
0
 def test_snowflake_time_is_1_and_epoch_is_1(self, time):
     time.return_value = 1
     epoch = 1
     guid = SnowFlake(0, 0, epoch)
     guoidvalue = guid.next()
     self.assertEqual(0, guoidvalue)
Example #4
0
 def test_snowflake_time_is_0(self, time):
     time.return_value = 0
     epoch = 0
     guid = SnowFlake(0, 0, epoch)
     guoidvalue = guid.next()
     self.assertEqual(0, guoidvalue)
Example #5
0
 def test_SnowFlake_time_is_1_and_epoch_is_0_and_workerid_1(self, time):
     time.return_value = 1
     epoch = 1
     guid = SnowFlake(0, 1, epoch)
     guoidvalue = guid.next()
     self.assertEqual(4096, guoidvalue)
Example #6
0
 def test_SnowFlake_time_is_1_and_epoch_is_0_and_datacenterid_is_1(self, time):
     time.return_value = 1
     epoch = 1
     guid = SnowFlake(1, 0, epoch)
     guoidvalue = guid.next()
     self.assertEqual(131072, guoidvalue)
Example #7
0
 def test_SnowFlake_time_is_1(self, time):
     time.return_value = 1
     epoch = 0
     guid = SnowFlake(0, 0, epoch)
     guoidvalue = guid.next()
     self.assertEqual(4194304000, guoidvalue)