def test_create_new_manufacturer(self):
     """
     Number of manufacturers returned by objects should increment after
     creating a new manufacturer
     """
     ManufacturerFactory.create()
     self.assertEqual(
         len(Manufacturer.objects.all()), len(self.manufacturers) + 1)
 def test_create_new_manufacturer(self):
     """
     Number of manufacturers returned by objects should increment after
     creating a new manufacturer
     """
     ManufacturerFactory.create()
     self.assertEqual(len(Manufacturer.objects.all()),
                      len(self.manufacturers) + 1)
def main(num_manufacturers, num_items_per_man, num_orders):
    mans = ManufacturerFactory.create_batch(num_manufacturers)
    print(f"Created {num_manufacturers} Manufacturers")

    items = list(
        chain.from_iterable([
            ItemFactory.create_batch(num_items_per_man, manufacturer=man)
            for man in mans
        ]))
    print(f"Created {len(items)} Items")

    users = UserFactory.create_batch(50)
    for _ in range(0, num_orders):
        num_items = random.randint(5, 20)
        user = random.choice(users)
        OrderFactory.create(user=user, items=random.sample(items, num_items))
    print(f"Created {num_orders} Orders")
 def setUp(self):
     self.manufacturer = ManufacturerFactory.create()
     reset_queries()
 def setUp(self):
     self.manufacturers = ManufacturerFactory.create_batch(size=5)
     self.cars = CarFactory.create_batch(size=5, make=self.manufacturers[0])
     self.drivers = DriverFactory.create_batch(size=5, cars=[self.cars[0]])
 def setUp(self):
     self.manufacturer = ManufacturerFactory.create(name='Honda')
     self.car = CarFactory.create(make=self.manufacturer, year=2015, model='Civic')
     reset_queries()
 def setUp(self):
     self.manufacturer = ManufacturerFactory.create()
     self.car = CarFactory.create(make=self.manufacturer, year=2015)
     reset_queries()
Esempio n. 8
0
 def setUp(self):
     self.cache_manager = CacheManager()
     self.cache_manager.model = Manufacturer()
     self.query_set = Manufacturer.objects.filter(name='name')
     ManufacturerFactory.create(name='name')
 def setUp(self):
     self.manufacturer = ManufacturerFactory.create()
     reset_queries()
 def setUp(self):
     self.manufacturer = ManufacturerFactory.create(name='Honda')
     self.car = CarFactory.create(make=self.manufacturer,
                                  year=2015,
                                  model='Civic')
     reset_queries()
 def setUp(self):
     self.manufacturers = ManufacturerFactory.create_batch(size=5)
     self.cars = CarFactory.create_batch(size=5, make=self.manufacturers[0])
     self.drivers = DriverFactory.create_batch(size=5, cars=[self.cars[0]])
 def setUp(self):
     self.manufacturer = ManufacturerFactory.create()
     self.car = CarFactory.create(make=self.manufacturer, year=2015)
     reset_queries()
 def setUp(self):
     self.cache_manager = CacheManager()
     self.cache_manager.model = Manufacturer()
     self.query_set = Manufacturer.objects.filter(name='name')
     ManufacturerFactory.create(name='name')