forked from pool/python-factory_boy
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-factory_boy?expand=0&rev=32
This commit is contained in:
parent
805f1b42f3
commit
4dde887c74
@ -1,92 +0,0 @@
|
|||||||
Index: factory_boy-3.2.0/tests/test_django.py
|
|
||||||
===================================================================
|
|
||||||
--- factory_boy-3.2.0.orig/tests/test_django.py
|
|
||||||
+++ factory_boy-3.2.0/tests/test_django.py
|
|
||||||
@@ -7,11 +7,14 @@ import os
|
|
||||||
import unittest
|
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
-import django
|
|
||||||
-from django import test as django_test
|
|
||||||
-from django.conf import settings
|
|
||||||
-from django.db.models import signals
|
|
||||||
-from django.test import utils as django_test_utils
|
|
||||||
+try:
|
|
||||||
+ import django
|
|
||||||
+ from django import test as django_test
|
|
||||||
+ from django.conf import settings
|
|
||||||
+ from django.db.models import signals
|
|
||||||
+ from django.test import utils as django_test_utils
|
|
||||||
+except ImportError:
|
|
||||||
+ raise unittest.SkipTest("No Django installed")
|
|
||||||
|
|
||||||
import factory.django
|
|
||||||
|
|
||||||
Index: factory_boy-3.2.0/tests/test_using.py
|
|
||||||
===================================================================
|
|
||||||
--- factory_boy-3.2.0.orig/tests/test_using.py
|
|
||||||
+++ factory_boy-3.2.0/tests/test_using.py
|
|
||||||
@@ -11,6 +11,7 @@ import unittest
|
|
||||||
|
|
||||||
import factory
|
|
||||||
from factory import errors
|
|
||||||
+nodjango = not hasattr(factory, 'django')
|
|
||||||
|
|
||||||
from . import utils
|
|
||||||
|
|
||||||
@@ -141,6 +142,7 @@ class SimpleBuildTestCase(unittest.TestC
|
|
||||||
self.assertEqual(obj.id, None)
|
|
||||||
self.assertEqual(obj.foo, 'bar')
|
|
||||||
|
|
||||||
+ @unittest.skipIf(nodjango, "No Django installed")
|
|
||||||
def test_create_custom_base(self):
|
|
||||||
obj = factory.create(FakeModel, foo='bar', FACTORY_CLASS=factory.django.DjangoModelFactory)
|
|
||||||
self.assertEqual(obj.id, 2)
|
|
||||||
@@ -156,6 +158,7 @@ class SimpleBuildTestCase(unittest.TestC
|
|
||||||
self.assertEqual(obj.id, None)
|
|
||||||
self.assertEqual(obj.foo, 'bar')
|
|
||||||
|
|
||||||
+ @unittest.skipIf(nodjango, "No Django installed")
|
|
||||||
def test_create_batch_custom_base(self):
|
|
||||||
objs = factory.create_batch(
|
|
||||||
FakeModel,
|
|
||||||
@@ -196,6 +199,7 @@ class SimpleBuildTestCase(unittest.TestC
|
|
||||||
self.assertEqual(obj.id, None)
|
|
||||||
self.assertEqual(obj.foo, 'bar')
|
|
||||||
|
|
||||||
+ @unittest.skipIf(nodjango, "No Django installed")
|
|
||||||
def test_generate_create_custom_base(self):
|
|
||||||
obj = factory.generate(
|
|
||||||
FakeModel,
|
|
||||||
@@ -231,6 +235,7 @@ class SimpleBuildTestCase(unittest.TestC
|
|
||||||
self.assertEqual(obj.id, None)
|
|
||||||
self.assertEqual(obj.foo, 'bar')
|
|
||||||
|
|
||||||
+ @unittest.skipIf(nodjango, "No Django installed")
|
|
||||||
def test_generate_batch_create_custom_base(self):
|
|
||||||
objs = factory.generate_batch(
|
|
||||||
FakeModel,
|
|
||||||
@@ -267,6 +272,7 @@ class SimpleBuildTestCase(unittest.TestC
|
|
||||||
self.assertEqual(obj.id, None)
|
|
||||||
self.assertEqual(obj.foo, 'bar')
|
|
||||||
|
|
||||||
+ @unittest.skipIf(nodjango, "No Django installed")
|
|
||||||
def test_simple_generate_create_custom_base(self):
|
|
||||||
obj = factory.simple_generate(FakeModel, True, foo='bar', FACTORY_CLASS=factory.django.DjangoModelFactory)
|
|
||||||
self.assertEqual(obj.id, 2)
|
|
||||||
@@ -292,6 +298,7 @@ class SimpleBuildTestCase(unittest.TestC
|
|
||||||
self.assertEqual(obj.id, None)
|
|
||||||
self.assertEqual(obj.foo, 'bar')
|
|
||||||
|
|
||||||
+ @unittest.skipIf(nodjango, "No Django installed")
|
|
||||||
def test_simple_generate_batch_create_custom_base(self):
|
|
||||||
objs = factory.simple_generate_batch(
|
|
||||||
FakeModel,
|
|
||||||
@@ -2046,6 +2053,7 @@ class BetterFakeModel:
|
|
||||||
self.id = None
|
|
||||||
|
|
||||||
|
|
||||||
+@unittest.skipIf(nodjango, "No Django installed")
|
|
||||||
class DjangoModelFactoryTestCase(unittest.TestCase):
|
|
||||||
def test_simple(self):
|
|
||||||
class FakeModelFactory(factory.django.DjangoModelFactory):
|
|
Loading…
Reference in New Issue
Block a user