def test__check_resource_incorrect_resource(self): class OneType(resource2.Resource): pass class AnotherType(resource2.Resource): pass value = AnotherType() decorated = proxy2._check_resource(strict=False)(self.sot.method) self.assertRaisesRegexp(ValueError, "Expected OneType but received AnotherType", decorated, self.sot, OneType, value)
def test__check_resource_strict_id(self): decorated = proxy2._check_resource(strict=True)(self.sot.method) self.assertRaisesRegexp(ValueError, "A Resource must be passed", decorated, self.sot, resource2.Resource, "this-is-not-a-resource")
def _test_correct(self, value): decorated = proxy2._check_resource(strict=False)(self.sot.method) rv = decorated(self.sot, resource2.Resource, value) self.assertEqual(value, rv)