We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Activate POST on collections
```
$ curl -H "Content-Type: application/json" \
          -X POST -d '{"data": {"test": "some_data"}}' --user testuser:abc123 \
          https://kinto.dev.mozaws.net/v1/buckets/test_bucket/collections

{"errno":115,"message":"Method not allowed on this endpoint.","code":405,"error":"Method Not Allowed"}
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `kinto/views/collections.py`
Content:
```
1 import colander
2 import jsonschema
3 from cliquet import resource
4 from jsonschema import exceptions as jsonschema_exceptions
5 
6 from kinto.views import NameGenerator
7 
8 
9 class JSONSchemaMapping(colander.SchemaNode):
10     def schema_type(self, **kw):
11         return colander.Mapping(unknown='preserve')
12 
13     def deserialize(self, cstruct=colander.null):
14         # Start by deserializing a simple mapping.
15         validated = super(JSONSchemaMapping, self).deserialize(cstruct)
16 
17         # In case it is optional in parent schema.
18         if not validated or validated in (colander.null, colander.drop):
19             return validated
20 
21         try:
22             jsonschema.Draft4Validator.check_schema(validated)
23         except jsonschema_exceptions.SchemaError as e:
24             self.raise_invalid(e.path.pop() + e.message)
25         return validated
26 
27 
28 class CollectionSchema(resource.ResourceSchema):
29     schema = JSONSchemaMapping(missing=colander.drop)
30     cache_expires = colander.SchemaNode(colander.Int(), missing=colander.drop)
31 
32     class Options:
33         preserve_unknown = True
34 
35 
36 @resource.register(name='collection',
37                    collection_methods=('GET',),
38                    collection_path='/buckets/{{bucket_id}}/collections',
39                    record_path='/buckets/{{bucket_id}}/collections/{{id}}')
40 class Collection(resource.ProtectedResource):
41     mapping = CollectionSchema()
42     permissions = ('read', 'write', 'record:create')
43 
44     def __init__(self, *args, **kwargs):
45         super(Collection, self).__init__(*args, **kwargs)
46         self.model.id_generator = NameGenerator()
47 
48     def get_parent_id(self, request):
49         bucket_id = request.matchdict['bucket_id']
50         parent_id = '/buckets/%s' % bucket_id
51         return parent_id
52 
53     def delete(self):
54         result = super(Collection, self).delete()
55 
56         # Delete records.
57         storage = self.model.storage
58         parent_id = '%s/collections/%s' % (self.model.parent_id,
59                                            self.record_id)
60         storage.delete_all(collection_id='record',
61                            parent_id=parent_id,
62                            with_deleted=False)
63         storage.purge_deleted(collection_id='record', parent_id=parent_id)
64 
65         return result
66
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/kinto/views/collections.py b/kinto/views/collections.py
--- a/kinto/views/collections.py
+++ b/kinto/views/collections.py
@@ -34,7 +34,7 @@
 
 
 @resource.register(name='collection',
-                   collection_methods=('GET',),
+                   collection_methods=('GET', 'POST'),
                    collection_path='/buckets/{{bucket_id}}/collections',
                    record_path='/buckets/{{bucket_id}}/collections/{{id}}')
 class Collection(resource.ProtectedResource):

{"golden_diff": "diff --git a/kinto/views/collections.py b/kinto/views/collections.py\n--- a/kinto/views/collections.py\n+++ b/kinto/views/collections.py\n@@ -34,7 +34,7 @@\n \n \n @resource.register(name='collection',\n-                   collection_methods=('GET',),\n+                   collection_methods=('GET', 'POST'),\n                    collection_path='/buckets/{{bucket_id}}/collections',\n                    record_path='/buckets/{{bucket_id}}/collections/{{id}}')\n class Collection(resource.ProtectedResource):\n", "issue": "Activate POST on collections\n```\n$ curl -H \"Content-Type: application/json\" \\\n          -X POST -d '{\"data\": {\"test\": \"some_data\"}}' --user testuser:abc123 \\\n          https://kinto.dev.mozaws.net/v1/buckets/test_bucket/collections\n\n{\"errno\":115,\"message\":\"Method not allowed on this endpoint.\",\"code\":405,\"error\":\"Method Not Allowed\"}\n```\n\n", "before_files": [{"content": "import colander\nimport jsonschema\nfrom cliquet import resource\nfrom jsonschema import exceptions as jsonschema_exceptions\n\nfrom kinto.views import NameGenerator\n\n\nclass JSONSchemaMapping(colander.SchemaNode):\n    def schema_type(self, **kw):\n        return colander.Mapping(unknown='preserve')\n\n    def deserialize(self, cstruct=colander.null):\n        # Start by deserializing a simple mapping.\n        validated = super(JSONSchemaMapping, self).deserialize(cstruct)\n\n        # In case it is optional in parent schema.\n        if not validated or validated in (colander.null, colander.drop):\n            return validated\n\n        try:\n            jsonschema.Draft4Validator.check_schema(validated)\n        except jsonschema_exceptions.SchemaError as e:\n            self.raise_invalid(e.path.pop() + e.message)\n        return validated\n\n\nclass CollectionSchema(resource.ResourceSchema):\n    schema = JSONSchemaMapping(missing=colander.drop)\n    cache_expires = colander.SchemaNode(colander.Int(), missing=colander.drop)\n\n    class Options:\n        preserve_unknown = True\n\n\n@resource.register(name='collection',\n                   collection_methods=('GET',),\n                   collection_path='/buckets/{{bucket_id}}/collections',\n                   record_path='/buckets/{{bucket_id}}/collections/{{id}}')\nclass Collection(resource.ProtectedResource):\n    mapping = CollectionSchema()\n    permissions = ('read', 'write', 'record:create')\n\n    def __init__(self, *args, **kwargs):\n        super(Collection, self).__init__(*args, **kwargs)\n        self.model.id_generator = NameGenerator()\n\n    def get_parent_id(self, request):\n        bucket_id = request.matchdict['bucket_id']\n        parent_id = '/buckets/%s' % bucket_id\n        return parent_id\n\n    def delete(self):\n        result = super(Collection, self).delete()\n\n        # Delete records.\n        storage = self.model.storage\n        parent_id = '%s/collections/%s' % (self.model.parent_id,\n                                           self.record_id)\n        storage.delete_all(collection_id='record',\n                           parent_id=parent_id,\n                           with_deleted=False)\n        storage.purge_deleted(collection_id='record', parent_id=parent_id)\n\n        return result\n", "path": "kinto/views/collections.py"}], "after_files": [{"content": "import colander\nimport jsonschema\nfrom cliquet import resource\nfrom jsonschema import exceptions as jsonschema_exceptions\n\nfrom kinto.views import NameGenerator\n\n\nclass JSONSchemaMapping(colander.SchemaNode):\n    def schema_type(self, **kw):\n        return colander.Mapping(unknown='preserve')\n\n    def deserialize(self, cstruct=colander.null):\n        # Start by deserializing a simple mapping.\n        validated = super(JSONSchemaMapping, self).deserialize(cstruct)\n\n        # In case it is optional in parent schema.\n        if not validated or validated in (colander.null, colander.drop):\n            return validated\n\n        try:\n            jsonschema.Draft4Validator.check_schema(validated)\n        except jsonschema_exceptions.SchemaError as e:\n            self.raise_invalid(e.path.pop() + e.message)\n        return validated\n\n\nclass CollectionSchema(resource.ResourceSchema):\n    schema = JSONSchemaMapping(missing=colander.drop)\n    cache_expires = colander.SchemaNode(colander.Int(), missing=colander.drop)\n\n    class Options:\n        preserve_unknown = True\n\n\n@resource.register(name='collection',\n                   collection_methods=('GET', 'POST'),\n                   collection_path='/buckets/{{bucket_id}}/collections',\n                   record_path='/buckets/{{bucket_id}}/collections/{{id}}')\nclass Collection(resource.ProtectedResource):\n    mapping = CollectionSchema()\n    permissions = ('read', 'write', 'record:create')\n\n    def __init__(self, *args, **kwargs):\n        super(Collection, self).__init__(*args, **kwargs)\n        self.model.id_generator = NameGenerator()\n\n    def get_parent_id(self, request):\n        bucket_id = request.matchdict['bucket_id']\n        parent_id = '/buckets/%s' % bucket_id\n        return parent_id\n\n    def delete(self):\n        result = super(Collection, self).delete()\n\n        # Delete records.\n        storage = self.model.storage\n        parent_id = '%s/collections/%s' % (self.model.parent_id,\n                                           self.record_id)\n        storage.delete_all(collection_id='record',\n                           parent_id=parent_id,\n                           with_deleted=False)\n        storage.purge_deleted(collection_id='record', parent_id=parent_id)\n\n        return result\n", "path": "kinto/views/collections.py"}]}