Beispiel #1
0
 def handle(self, **options):
     print "Finding the maximum person ID from PopIt"
     max_person_id = -1
     for person in popit_unwrap_pagination(self.api.persons, per_page=100):
         person_id = int(person['id'])
         max_person_id = max(person_id, max_person_id)
     print "Setting maximum PopIt person ID to:", max_person_id
     MaxPopItIds.update_max_persons_id(max_person_id)
 def handle(self, **options):
     print "Finding the maximum person ID from PopIt"
     max_person_id = -1
     for person in popit_unwrap_pagination(
             self.api.persons,
             per_page=100
     ):
         person_id = int(person['id'])
         max_person_id = max(person_id, max_person_id)
     print "Setting maximum PopIt person ID to:", max_person_id
     MaxPopItIds.update_max_persons_id(max_person_id)
 def test_update_max_persons_id(self):
     new_max = 10
     MaxPopItIds.update_max_persons_id(new_max)
     self.assertEqual(MaxPopItIds.get_max_persons_id(), 10)
 def test_get_max_persons_id(self):
     self.assertEqual(MaxPopItIds.get_max_persons_id(), 0)
 def test_update_max_persons_id_less_than_existing(self):
     MaxPopItIds.update_max_persons_id(10)
     self.assertRaises(ValueError, MaxPopItIds.update_max_persons_id, 5)