@pytest.mark.django_db
def test_coop_create_with_existing_type(self):
    ' Test customer model '
    coop_from_factory = CoopFactory()
    self.assertIsNotNone(coop_from_factory)
    coop_types = coop_from_factory.types
    coop = CoopFactory.create(types=[coop_types.all().first()], addresses=coop_from_factory.addresses.all())
    self.assertIsNotNone(coop)
Test customer model
@pytest.mark.django_db
def test_coop_create_with_existing_type(self):
    '  '
    coop_from_factory = CoopFactory()
    self.assertIsNotNone(coop_from_factory)
    coop_types = coop_from_factory.types
    coop = CoopFactory.create(types=[coop_types.all().first()], addresses=coop_from_factory.addresses.all())
    self.assertIsNotNone(coop)