def test_unregister(self): gen = AbstractKeyGenerator() gen.register() registry = Registry() self.assertEqual(registry.get('abstract'), gen) gen.unregister() self.assertRaises(GeneratorError, registry.get, 'abstract')
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)
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)
def test_register(self): gen = AbstractKeyGenerator() gen.register() registry = Registry() self.assertEqual(registry.get('abstract'), gen)
def test_init(self): gen = AbstractKeyGenerator() self.assertEqual(gen.length, 0) #self.assertEqual(gen.name, '') self.assertEqual(gen.seed, None)