示例#1
0
 def test_unregister(self):
     gen = AbstractKeyGenerator()
     gen.register()
     registry = Registry()
     self.assertEqual(registry.get('abstract'), gen)
     gen.unregister()
     self.assertRaises(GeneratorError, registry.get, 'abstract')
示例#2
0
 def test_tweet_safe(self):
     gen = AbstractKeyGenerator()
     self.assertEqual(gen.tweet_safe(), True)
     gen = AbstractKeyGenerator(length=40)
     self.assertEqual(gen.tweet_safe(), True)
     gen = AbstractKeyGenerator(length=41)
     self.assertEqual(gen.tweet_safe(), False)
示例#3
0
 def test_sms_safe(self):
     gen = AbstractKeyGenerator()
     self.assertEqual(gen.sms_safe(), True)
     gen = AbstractKeyGenerator(length=10)
     self.assertEqual(gen.sms_safe(), True)
     gen = AbstractKeyGenerator(length=11)
     self.assertEqual(gen.sms_safe(), False)
示例#4
0
 def test_tweet_safe(self):
     gen = AbstractKeyGenerator()
     self.assertEqual(gen.tweet_safe(), True)
     gen = AbstractKeyGenerator(length=40)
     self.assertEqual(gen.tweet_safe(), True)
     gen = AbstractKeyGenerator(length=41)
     self.assertEqual(gen.tweet_safe(), False)
示例#5
0
 def test_sms_safe(self):
     gen = AbstractKeyGenerator()
     self.assertEqual(gen.sms_safe(), True)
     gen = AbstractKeyGenerator(length=10)
     self.assertEqual(gen.sms_safe(), True)
     gen = AbstractKeyGenerator(length=11)
     self.assertEqual(gen.sms_safe(), False)
示例#6
0
 def test_unregister(self):
     gen = AbstractKeyGenerator()
     gen.register()
     registry = Registry()
     self.assertEqual(registry.get('abstract'), gen)
     gen.unregister()
     self.assertRaises(GeneratorError, registry.get, 'abstract')
示例#7
0
 def test_register(self):
     gen = AbstractKeyGenerator()
     gen.register()
     registry = Registry()
     self.assertEqual(registry.get('abstract'), gen)
示例#8
0
 def test_register(self):
     gen = AbstractKeyGenerator()
     gen.register()
     registry = Registry()
     self.assertEqual(registry.get('abstract'), gen)
示例#9
0
 def test_init(self):
     gen = AbstractKeyGenerator()
     self.assertEqual(gen.length, 0)
     #self.assertEqual(gen.name, '')
     self.assertEqual(gen.seed, None)