Beispiel #1
0
 def first(self):
     if self.none_count >= 3:
         if self.max_items:
             if self.current_item > self.max_items:
                 return None
         # Generate a mock item with initial alias ('mock', id)
         item = item.make()
         item.id = self.current_item
         item.aliases['mock'] = str(item.id)
         self.items[self.current_item] = item
         return item
     else:
         self.none_count += 1
         return None
Beispiel #2
0
 def first(self):
     if self.none_count >= 3:
         if self.max_items:
             if self.current_item > self.max_items:
                 return None
         # Generate a mock item with initial alias ('mock', id)
         item = item.make()
         item.id = self.current_item
         item.aliases['mock'] = str(item.id)
         self.items[self.current_item] = item
         return item
     else:
         self.none_count += 1
         return None
 def test_make_new(self):
     '''create an item from scratch.'''
     item = item_module.make()
     assert_equals(len(item["_id"]), 24)
     assert_equals(item["aliases"], {})
Beispiel #4
0
 def test_make_new(self):
     '''create an item from scratch.'''
     item = item_module.make()
     assert_equals(len(item["_id"]), 24)
     assert item["created"] < datetime.datetime.now().isoformat()
     assert_equals(item["aliases"], {})