From a0e36adebcba165044708c675107334bd40a8782 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 25 Nov 2017 21:56:48 +0100 Subject: [PATCH] Put skipIf condition at correct place --- datacenterlight/tasks.py | 3 --- datacenterlight/tests.py | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/datacenterlight/tasks.py b/datacenterlight/tasks.py index 0767a07d..3db6eb54 100644 --- a/datacenterlight/tasks.py +++ b/datacenterlight/tasks.py @@ -8,7 +8,6 @@ from django.core.mail import EmailMessage from django.core.urlresolvers import reverse from django.utils import translation from django.utils.translation import ugettext_lazy as _ -from unittest import skipIf from dynamicweb.celery import app from hosting.models import HostingOrder, HostingBill @@ -49,8 +48,6 @@ def retry_task(task, exception=None): raise task.retry(**kwargs) -@skipIf(settings.OPENNEBULA_USERNAME is None or - settings.OPENNEBULA_PASSWORD is None) @app.task(bind=True, max_retries=settings.CELERY_MAX_RETRIES) def create_vm_task(self, vm_template_id, user, specs, template, stripe_customer_id, billing_address_data, diff --git a/datacenterlight/tests.py b/datacenterlight/tests.py index 6167e3e2..f90dcf1e 100644 --- a/datacenterlight/tests.py +++ b/datacenterlight/tests.py @@ -8,6 +8,8 @@ from django.conf import settings from django.core.management import call_command from django.test import TestCase, override_settings from model_mommy import mommy +from unittest import skipIf + from datacenterlight.models import VMTemplate from datacenterlight.tasks import create_vm_task from membership.models import StripeCustomer @@ -47,6 +49,10 @@ class CeleryTaskTestCase(TestCase): # OpenNebula call_command('fetchvmtemplates') + @skipIf(settings.OPENNEBULA_USERNAME is None or + settings.OPENNEBULA_USERNAME is "", + """Opennebula details unavailable, so skipping test_create_vm_task + """) def test_create_vm_task(self): """Tests the create vm task for monthly subscription