(self)
| 202 | self.assertIs(handler2, info.handler) |
| 203 | |
| 204 | def test_raise_method_not_allowed(self): |
| 205 | handler1 = self.make_handler() |
| 206 | handler2 = self.make_handler() |
| 207 | self.router.add_route('GET', '/', handler1) |
| 208 | self.router.add_route('POST', '/', handler2) |
| 209 | req = self.make_request('PUT', '/') |
| 210 | |
| 211 | match_info = self.loop.run_until_complete(self.router.resolve(req)) |
| 212 | self.assertIsInstance(match_info.route, SystemRoute) |
| 213 | self.assertEqual({}, match_info) |
| 214 | |
| 215 | with self.assertRaises(HTTPMethodNotAllowed) as ctx: |
| 216 | self.loop.run_until_complete(match_info.handler(req)) |
| 217 | |
| 218 | exc = ctx.exception |
| 219 | self.assertEqual('PUT', exc.method) |
| 220 | self.assertEqual(405, exc.status) |
| 221 | self.assertEqual({'POST', 'GET'}, exc.allowed_methods) |
| 222 | |
| 223 | def test_raise_method_not_found(self): |
| 224 | handler = self.make_handler() |
nothing calls this directly
no test coverage detected