Merge "Use nova.test.TestCase as the base test class."

This commit is contained in:
Jenkins 2012-12-13 02:55:18 +00:00 committed by Gerrit Code Review
commit b963a93194
7 changed files with 14 additions and 19 deletions

View File

@ -15,8 +15,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import unittest
from lxml import etree from lxml import etree
import mox import mox
import webob import webob
@ -1014,9 +1012,10 @@ class TestSecurityGroupRules(test.TestCase):
req, {'security_group_rule': rule}) req, {'security_group_rule': rule})
class TestSecurityGroupRulesXMLDeserializer(unittest.TestCase): class TestSecurityGroupRulesXMLDeserializer(test.TestCase):
def setUp(self): def setUp(self):
super(TestSecurityGroupRulesXMLDeserializer, self).setUp()
self.deserializer = security_groups.SecurityGroupRulesXMLDeserializer() self.deserializer = security_groups.SecurityGroupRulesXMLDeserializer()
def test_create_request(self): def test_create_request(self):
@ -1064,9 +1063,10 @@ class TestSecurityGroupRulesXMLDeserializer(unittest.TestCase):
self.assertEquals(request['body'], expected) self.assertEquals(request['body'], expected)
class TestSecurityGroupXMLDeserializer(unittest.TestCase): class TestSecurityGroupXMLDeserializer(test.TestCase):
def setUp(self): def setUp(self):
super(TestSecurityGroupXMLDeserializer, self).setUp()
self.deserializer = security_groups.SecurityGroupXMLDeserializer() self.deserializer = security_groups.SecurityGroupXMLDeserializer()
def test_create_request(self): def test_create_request(self):
@ -1109,8 +1109,9 @@ class TestSecurityGroupXMLDeserializer(unittest.TestCase):
self.assertEquals(request['body'], expected) self.assertEquals(request['body'], expected)
class TestSecurityGroupXMLSerializer(unittest.TestCase): class TestSecurityGroupXMLSerializer(test.TestCase):
def setUp(self): def setUp(self):
super(TestSecurityGroupXMLSerializer, self).setUp()
self.namespace = wsgi.XMLNS_V11 self.namespace = wsgi.XMLNS_V11
self.rule_serializer = security_groups.SecurityGroupRuleTemplate() self.rule_serializer = security_groups.SecurityGroupRuleTemplate()
self.index_serializer = security_groups.SecurityGroupsTemplate() self.index_serializer = security_groups.SecurityGroupsTemplate()

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import unittest
from lxml import etree from lxml import etree
from nova.api.openstack import compute from nova.api.openstack import compute
@ -60,7 +58,7 @@ class ServerDiagnosticsTest(test.TestCase):
self.assertEqual(output, {'data': 'Some diagnostic info'}) self.assertEqual(output, {'data': 'Some diagnostic info'})
class TestServerDiagnosticsXMLSerializer(unittest.TestCase): class TestServerDiagnosticsXMLSerializer(test.TestCase):
namespace = wsgi.XMLNS_V11 namespace = wsgi.XMLNS_V11
def _tag(self, elem): def _tag(self, elem):

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import unittest
import mox import mox
import webob import webob

View File

@ -16,7 +16,6 @@
# under the License. # under the License.
import time import time
import unittest
from nova.openstack.common.log import logging from nova.openstack.common.log import logging
from nova.tests import fake_network from nova.tests import fake_network

View File

@ -21,8 +21,6 @@
import os.path import os.path
import tempfile import tempfile
import unittest
import nova.exception import nova.exception
from nova import test from nova import test
import nova.wsgi import nova.wsgi
@ -42,7 +40,7 @@ class TestLoaderNothingExists(test.TestCase):
) )
class TestLoaderNormalFilesystem(unittest.TestCase): class TestLoaderNormalFilesystem(test.TestCase):
"""Loader tests with normal filesystem (unmodified os.path module).""" """Loader tests with normal filesystem (unmodified os.path module)."""
_paste_config = """ _paste_config = """
@ -52,6 +50,7 @@ document_root = /tmp
""" """
def setUp(self): def setUp(self):
super(TestLoaderNormalFilesystem, self).setUp()
self.config = tempfile.NamedTemporaryFile(mode="w+t") self.config = tempfile.NamedTemporaryFile(mode="w+t")
self.config.write(self._paste_config.lstrip()) self.config.write(self._paste_config.lstrip())
self.config.seek(0) self.config.seek(0)
@ -74,9 +73,10 @@ document_root = /tmp
def tearDown(self): def tearDown(self):
self.config.close() self.config.close()
super(TestLoaderNormalFilesystem, self).tearDown()
class TestWSGIServer(unittest.TestCase): class TestWSGIServer(test.TestCase):
"""WSGI server tests.""" """WSGI server tests."""
def test_no_app(self): def test_no_app(self):

View File

@ -16,7 +16,6 @@
from nova import test from nova import test
from nova.virt.xenapi import volumeops from nova.virt.xenapi import volumeops
import unittest
class VolumeAttachTestCase(test.TestCase): class VolumeAttachTestCase(test.TestCase):

View File

@ -2,12 +2,12 @@ import mox
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
from nova import test
from nova.tests.xenapi import stubs from nova.tests.xenapi import stubs
from nova.virt.xenapi import driver as xenapi_conn from nova.virt.xenapi import driver as xenapi_conn
from nova.virt.xenapi import fake from nova.virt.xenapi import fake
from nova.virt.xenapi import vm_utils from nova.virt.xenapi import vm_utils
from nova.virt.xenapi import volume_utils from nova.virt.xenapi import volume_utils
import unittest
class GetInstanceForVdisForSrTestCase(stubs.XenAPITestBase): class GetInstanceForVdisForSrTestCase(stubs.XenAPITestBase):
@ -87,7 +87,7 @@ class GetInstanceForVdisForSrTestCase(stubs.XenAPITestBase):
driver._session, dev_params) driver._session, dev_params)
class VMRefOrRaiseVMFoundTestCase(unittest.TestCase): class VMRefOrRaiseVMFoundTestCase(test.TestCase):
def test_lookup_call(self): def test_lookup_call(self):
mock = mox.Mox() mock = mox.Mox()
@ -111,7 +111,7 @@ class VMRefOrRaiseVMFoundTestCase(unittest.TestCase):
mock.VerifyAll() mock.VerifyAll()
class VMRefOrRaiseVMNotFoundTestCase(unittest.TestCase): class VMRefOrRaiseVMNotFoundTestCase(test.TestCase):
def test_exception_raised(self): def test_exception_raised(self):
mock = mox.Mox() mock = mox.Mox()