Add skipif to tests that require connecting to OpenNebula
This commit is contained in:
		
					parent
					
						
							
								a9a77cd6ac
							
						
					
				
			
			
				commit
				
					
						2bc4db1cab
					
				
			
		
					 2 changed files with 35 additions and 3 deletions
				
			
		|  | @ -1,4 +1,3 @@ | ||||||
| from unittest import mock |  | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from django.test import TestCase | from django.test import TestCase | ||||||
| from django.core.urlresolvers import reverse | from django.core.urlresolvers import reverse | ||||||
|  | @ -6,7 +5,7 @@ from django.core.urlresolvers import resolve | ||||||
| from django.contrib.auth.tokens import default_token_generator | from django.contrib.auth.tokens import default_token_generator | ||||||
| from django.utils.http import urlsafe_base64_encode | from django.utils.http import urlsafe_base64_encode | ||||||
| from django.utils.encoding import force_bytes | from django.utils.encoding import force_bytes | ||||||
| 
 | from unittest import skipIf | ||||||
| 
 | 
 | ||||||
| from model_mommy import mommy | from model_mommy import mommy | ||||||
| from stored_messages.models import Inbox | from stored_messages.models import Inbox | ||||||
|  | @ -41,6 +40,11 @@ class ProcessVMSelectionTestMixin(object): | ||||||
|     #                          status_code=302, target_status_code=200) |     #                          status_code=302, target_status_code=200) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIf( | ||||||
|  |     settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is | ||||||
|  |     "test_domain", | ||||||
|  |     """OpenNebula details unavailable, so skipping DjangoHostingViewTest""" | ||||||
|  | ) | ||||||
| class DjangoHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | class DjangoHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  | @ -60,6 +64,11 @@ class DjangoHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIf( | ||||||
|  |     settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is | ||||||
|  |     "test_domain", | ||||||
|  |     """OpenNebula details unavailable, so skipping RailsHostingViewTest""" | ||||||
|  | ) | ||||||
| class RailsHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | class RailsHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  | @ -79,6 +88,11 @@ class RailsHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIf( | ||||||
|  |     settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is | ||||||
|  |     "test_domain", | ||||||
|  |     """OpenNebula details unavailable, so skipping NodeJSHostingViewTest""" | ||||||
|  | ) | ||||||
| class NodeJSHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | class NodeJSHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  | @ -98,6 +112,11 @@ class NodeJSHostingViewTest(TestCase, ProcessVMSelectionTestMixin): | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIf( | ||||||
|  |     settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is | ||||||
|  |     "test_domain", | ||||||
|  |     """OpenNebula details unavailable, so skipping HostingPricingViewTest""" | ||||||
|  | ) | ||||||
| class HostingPricingViewTest(TestCase): | class HostingPricingViewTest(TestCase): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  |  | ||||||
|  | @ -1,13 +1,21 @@ | ||||||
| import random | import random | ||||||
| import string | import string | ||||||
| 
 | 
 | ||||||
|  | from django.conf import settings | ||||||
| from django.test import TestCase | from django.test import TestCase | ||||||
|  | from unittest import skipIf | ||||||
| 
 | 
 | ||||||
| from .models import OpenNebulaManager | from .models import OpenNebulaManager | ||||||
| from .serializers import VirtualMachineSerializer | from .serializers import VirtualMachineSerializer | ||||||
| from utils.models import CustomUser | from utils.models import CustomUser | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIf( | ||||||
|  |     settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is | ||||||
|  |     "test_domain", | ||||||
|  |     """OpenNebula details unavailable, so skipping  | ||||||
|  |        OpenNebulaManagerTestCases""" | ||||||
|  | ) | ||||||
| class OpenNebulaManagerTestCases(TestCase): | class OpenNebulaManagerTestCases(TestCase): | ||||||
|     """This class defines the test suite for the opennebula manager model.""" |     """This class defines the test suite for the opennebula manager model.""" | ||||||
| 
 | 
 | ||||||
|  | @ -119,7 +127,12 @@ class OpenNebulaManagerTestCases(TestCase): | ||||||
|         """Test the opennebula manager requires the user to have a ssh key when |         """Test the opennebula manager requires the user to have a ssh key when | ||||||
|         creating a new vm""" |         creating a new vm""" | ||||||
| 
 | 
 | ||||||
| 
 | @skipIf( | ||||||
|  |     settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is | ||||||
|  |     "test_domain", | ||||||
|  |     """OpenNebula details unavailable, so skipping  | ||||||
|  |        VirtualMachineSerializerTestCase""" | ||||||
|  | ) | ||||||
| class VirtualMachineSerializerTestCase(TestCase): | class VirtualMachineSerializerTestCase(TestCase): | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         """Define the test client and other test variables.""" |         """Define the test client and other test variables.""" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue