Merge "Replace assertRaisesRegexp with assertRaisesRegex"
This commit is contained in:
commit
c5e7b4654b
|
@ -68,9 +68,9 @@ class Test_check_resource(testtools.TestCase):
|
||||||
|
|
||||||
def test_strict_id(self):
|
def test_strict_id(self):
|
||||||
decorated = proxy._check_resource(strict=True)(self.sot.method)
|
decorated = proxy._check_resource(strict=True)(self.sot.method)
|
||||||
self.assertRaisesRegexp(ValueError, "A Resource must be passed",
|
self.assertRaisesRegex(ValueError, "A Resource must be passed",
|
||||||
decorated, self.sot, resource.Resource,
|
decorated, self.sot, resource.Resource,
|
||||||
"this-is-not-a-resource")
|
"this-is-not-a-resource")
|
||||||
|
|
||||||
def test_incorrect_resource(self):
|
def test_incorrect_resource(self):
|
||||||
class OneType(resource.Resource):
|
class OneType(resource.Resource):
|
||||||
|
@ -81,9 +81,9 @@ class Test_check_resource(testtools.TestCase):
|
||||||
|
|
||||||
value = AnotherType()
|
value = AnotherType()
|
||||||
decorated = proxy._check_resource(strict=False)(self.sot.method)
|
decorated = proxy._check_resource(strict=False)(self.sot.method)
|
||||||
self.assertRaisesRegexp(ValueError,
|
self.assertRaisesRegex(ValueError,
|
||||||
"Expected OneType but received AnotherType",
|
"Expected OneType but received AnotherType",
|
||||||
decorated, self.sot, OneType, value)
|
decorated, self.sot, OneType, value)
|
||||||
|
|
||||||
|
|
||||||
class TestProxyDelete(testtools.TestCase):
|
class TestProxyDelete(testtools.TestCase):
|
||||||
|
@ -127,7 +127,7 @@ class TestProxyDelete(testtools.TestCase):
|
||||||
self.res.delete.side_effect = exceptions.NotFoundException(
|
self.res.delete.side_effect = exceptions.NotFoundException(
|
||||||
message="test", http_status=404)
|
message="test", http_status=404)
|
||||||
|
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ResourceNotFound,
|
exceptions.ResourceNotFound,
|
||||||
"No %s found for %s" % (DeleteableResource.__name__, self.res),
|
"No %s found for %s" % (DeleteableResource.__name__, self.res),
|
||||||
self.sot._delete, DeleteableResource, self.res,
|
self.sot._delete, DeleteableResource, self.res,
|
||||||
|
@ -239,7 +239,7 @@ class TestProxyGet(testtools.TestCase):
|
||||||
self.res.get.side_effect = exceptions.NotFoundException(
|
self.res.get.side_effect = exceptions.NotFoundException(
|
||||||
message="test", http_status=404)
|
message="test", http_status=404)
|
||||||
|
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ResourceNotFound,
|
exceptions.ResourceNotFound,
|
||||||
"No %s found for %s" % (RetrieveableResource.__name__, self.res),
|
"No %s found for %s" % (RetrieveableResource.__name__, self.res),
|
||||||
self.sot._get, RetrieveableResource, self.res)
|
self.sot._get, RetrieveableResource, self.res)
|
||||||
|
|
|
@ -70,9 +70,9 @@ class TestProxyPrivate(testtools.TestCase):
|
||||||
|
|
||||||
def test__check_resource_strict_id(self):
|
def test__check_resource_strict_id(self):
|
||||||
decorated = proxy2._check_resource(strict=True)(self.sot.method)
|
decorated = proxy2._check_resource(strict=True)(self.sot.method)
|
||||||
self.assertRaisesRegexp(ValueError, "A Resource must be passed",
|
self.assertRaisesRegex(ValueError, "A Resource must be passed",
|
||||||
decorated, self.sot, resource2.Resource,
|
decorated, self.sot, resource2.Resource,
|
||||||
"this-is-not-a-resource")
|
"this-is-not-a-resource")
|
||||||
|
|
||||||
def test__check_resource_incorrect_resource(self):
|
def test__check_resource_incorrect_resource(self):
|
||||||
class OneType(resource2.Resource):
|
class OneType(resource2.Resource):
|
||||||
|
@ -83,9 +83,9 @@ class TestProxyPrivate(testtools.TestCase):
|
||||||
|
|
||||||
value = AnotherType()
|
value = AnotherType()
|
||||||
decorated = proxy2._check_resource(strict=False)(self.sot.method)
|
decorated = proxy2._check_resource(strict=False)(self.sot.method)
|
||||||
self.assertRaisesRegexp(ValueError,
|
self.assertRaisesRegex(ValueError,
|
||||||
"Expected OneType but received AnotherType",
|
"Expected OneType but received AnotherType",
|
||||||
decorated, self.sot, OneType, value)
|
decorated, self.sot, OneType, value)
|
||||||
|
|
||||||
def test__get_uri_attribute_no_parent(self):
|
def test__get_uri_attribute_no_parent(self):
|
||||||
class Child(resource2.Resource):
|
class Child(resource2.Resource):
|
||||||
|
@ -199,7 +199,7 @@ class TestProxyDelete(testtools.TestCase):
|
||||||
self.res.delete.side_effect = exceptions.NotFoundException(
|
self.res.delete.side_effect = exceptions.NotFoundException(
|
||||||
message="test", http_status=404)
|
message="test", http_status=404)
|
||||||
|
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ResourceNotFound,
|
exceptions.ResourceNotFound,
|
||||||
"No %s found for %s" % (DeleteableResource.__name__, self.res),
|
"No %s found for %s" % (DeleteableResource.__name__, self.res),
|
||||||
self.sot._delete, DeleteableResource, self.res,
|
self.sot._delete, DeleteableResource, self.res,
|
||||||
|
@ -312,7 +312,7 @@ class TestProxyGet(testtools.TestCase):
|
||||||
self.res.get.side_effect = exceptions.NotFoundException(
|
self.res.get.side_effect = exceptions.NotFoundException(
|
||||||
message="test", http_status=404)
|
message="test", http_status=404)
|
||||||
|
|
||||||
self.assertRaisesRegexp(
|
self.assertRaisesRegex(
|
||||||
exceptions.ResourceNotFound,
|
exceptions.ResourceNotFound,
|
||||||
"No %s found for %s" % (RetrieveableResource.__name__, self.res),
|
"No %s found for %s" % (RetrieveableResource.__name__, self.res),
|
||||||
self.sot._get, RetrieveableResource, self.res)
|
self.sot._get, RetrieveableResource, self.res)
|
||||||
|
|
Loading…
Reference in New Issue