Update all test base classes to use base.TestCase

We have a centrally defined test case base class that handles a set of
things like log capture, mocking time.sleep and setting up
requests-mock.

We also had a split base test case, with some things using TestCase and
some using RequestsMockTestCase. This was a holdover from the transition
to requests-mock. We are finally at the point where we don't need the
split, so merge TestCase and RequestsMockTest case.

Then, update all of the tests to use the new combined base class.

Also, replace a use of unittest.skipTest with self.skipTest from the
base class.

Change-Id: I2cc3e201a5241262e5d102d3de8423c4fb2a8c4a
This commit is contained in:
Monty Taylor
2018-02-02 06:45:29 -06:00
parent 18a178456c
commit 1b43673c04
217 changed files with 430 additions and 444 deletions

View File

@@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal import baremetal_service
class TestBaremetalService(testtools.TestCase):
class TestBaremetalService(base.TestCase):
def test_service(self):
sot = baremetal_service.BaremetalService()

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal import version
@@ -23,7 +23,7 @@ EXAMPLE = {
}
class TestVersion(testtools.TestCase):
class TestVersion(base.TestCase):
def test_basic(self):
sot = version.Version()

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import chassis
@@ -43,7 +43,7 @@ FAKE = {
}
class TestChassis(testtools.TestCase):
class TestChassis(base.TestCase):
def test_basic(self):
sot = chassis.Chassis()
@@ -69,7 +69,7 @@ class TestChassis(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestChassisDetail(testtools.TestCase):
class TestChassisDetail(base.TestCase):
def test_basic(self):
sot = chassis.ChassisDetail()

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import driver
@@ -43,7 +43,7 @@ FAKE = {
}
class TestDriver(testtools.TestCase):
class TestDriver(base.TestCase):
def test_basic(self):
sot = driver.Driver()

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import node
@@ -91,7 +91,7 @@ FAKE = {
}
class TestNode(testtools.TestCase):
class TestNode(base.TestCase):
def test_basic(self):
sot = node.Node()
@@ -145,7 +145,7 @@ class TestNode(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestNodeDetail(testtools.TestCase):
class TestNodeDetail(base.TestCase):
def test_basic(self):
sot = node.NodeDetail()

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import port
@@ -42,7 +42,7 @@ FAKE = {
}
class TestPort(testtools.TestCase):
class TestPort(base.TestCase):
def test_basic(self):
sot = port.Port()
@@ -73,7 +73,7 @@ class TestPort(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestPortDetail(testtools.TestCase):
class TestPortDetail(base.TestCase):
def test_basic(self):
sot = port.PortDetail()

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import port_group
@@ -47,7 +47,7 @@ FAKE = {
}
class TestPortGroup(testtools.TestCase):
class TestPortGroup(base.TestCase):
def test_basic(self):
sot = port_group.PortGroup()
@@ -78,7 +78,7 @@ class TestPortGroup(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestPortGroupDetail(testtools.TestCase):
class TestPortGroupDetail(base.TestCase):
def test_basic(self):
sot = port_group.PortGroupDetail()