Esempio n. 1
0
 def test_103_consumer_manager_remove(self):
     m = ConsumerManager()
     c1 = Consumer('consumer-key', 'consumer-secret')
     c2 = Consumer('consumer-key2', 'consumer-secret')
     m.add(c1)
     m.add(c2)
     m.remove(c1.key)
     m.remove(c2)
     self.assertEqual(len(m._consumers), 0)
Esempio n. 2
0
    def test_101_consumer_manager_addget(self):
        m = ConsumerManager()
        consumer = Consumer('consumer-key', 'consumer-secret')
        m.add(consumer)
        result = m.get('consumer-key')
        self.assertEqual(result, consumer)

        consumer2 = Consumer('consumer2-key', 'consumer-secret', u'A Consumer')
        m.add(consumer2)
        result = m.get('consumer2-key')
        self.assertEqual(result, consumer2)
        self.assertEqual(result.title, consumer2.title)
Esempio n. 3
0
 def test_102_consumer_manager_doubleadd(self):
     m = ConsumerManager()
     consumer = Consumer('consumer-key', 'consumer-secret')
     m.add(consumer)
     self.assertRaises(ValueError, m.add, consumer)
Esempio n. 4
0
 def test_100_consumer_manager_empty(self):
     m = ConsumerManager()
     self.assertEqual(m.get('consumer-key'), None)