Exemplo n.º 1
0
    def test_simple_generate_batch_create(self):
        objs = factory.simple_generate_batch(FakeDjangoModel, True, 20, foo='bar')

        self.assertEqual(20, len(objs))
        self.assertEqual(20, len(set(objs)))

        for obj in objs:
            self.assertEqual(obj.id, 1)
            self.assertEqual(obj.foo, 'bar')
Exemplo n.º 2
0
    def test_simple_generate_batch_build(self):
        objs = factory.simple_generate_batch(FakeDjangoModel, False, 20, foo='bar')

        self.assertEqual(20, len(objs))
        self.assertEqual(20, len(set(objs)))

        for obj in objs:
            self.assertEqual(obj.id, None)
            self.assertEqual(obj.foo, 'bar')
Exemplo n.º 3
0
    def test_simple_generate_batch_build(self):
        objs = factory.simple_generate_batch(FakeModel, False, 20, foo='bar')

        self.assertEqual(20, len(objs))
        self.assertEqual(20, len(set(objs)))

        for obj in objs:
            self.assertEqual(obj.id, None)
            self.assertEqual(obj.foo, 'bar')
Exemplo n.º 4
0
    def test_simple_generate_batch_create(self):
        objs = factory.simple_generate_batch(FakeModel, True, 20, foo='bar')

        self.assertEqual(20, len(objs))
        self.assertEqual(20, len(set(objs)))

        for obj in objs:
            self.assertEqual(obj.id, 2)
            self.assertEqual(obj.foo, 'bar')
Exemplo n.º 5
0
    def test_simple_generate_batch_create_custom_base(self):
        objs = factory.simple_generate_batch(FakeModel, True, 20, foo='bar',
                FACTORY_CLASS=factory.DjangoModelFactory)

        self.assertEqual(20, len(objs))
        self.assertEqual(20, len(set(objs)))

        for obj in objs:
            self.assertEqual(obj.id, 2)
            self.assertEqual(obj.foo, 'bar')