def test__find_schema_invalid_uri_parameter(self): path_segments = { 'remaining': ['/api', '/v5', '/test', '/fake_id:werd'], 'path_info': '/api/v5/test/fake_id:werd' } with self.assertRaises(UndefinedSchemaError): _find_resource(self.raw_schema, path_segments)
def test__find_schema_embedded_invalid_uri_param(self): path_segments = { 'remaining': ['/api', '/v5', '/test', '/fake:12', '/extended'], 'path_info': '/api/v5/test/fake:12/extended' } with self.assertRaises(UndefinedSchemaError): _find_resource(self.raw_schema, path_segments)
def test__find_schema_no_slash(self): path_segments = { 'remaining': ['/api', '/v5', '/test'], 'path_info': '/api/v5/test' } sub_schema = _find_resource(self.raw_schema, path_segments) self.assertEqual(sub_schema['methods'][0]['method'], 'short')
def test__find_schema_uri_parameter(self): path_segments = { 'remaining': ['/api', '/v5', '/test', '/fake_id:1001'], 'path_info': '/api/v5/test/fake_id:1001' } sub_schema = _find_resource(self.raw_schema, path_segments) self.assertEqual(sub_schema['methods'][0]['method'], 'uri_param')
def test__find_schema_deep_endpoint_past_uri_param(self): path_segments = { 'remaining': ['/api', '/v5', '/test', '/fake_id:12', '/extended'], 'path_info': '/api/v5/test/fake_id:12/extended' } sub_schema = _find_resource(self.raw_schema, path_segments) self.assertEqual(sub_schema['methods'][0]['method'], 'long')