Fixed typo call to check_permissions()

Also added unit test to cover the function containing the typo.
This commit is contained in:
Sybren A. Stüvel 2016-05-09 12:52:44 +02:00
parent 4316c4d450
commit a90f13486a
2 changed files with 14 additions and 1 deletions

View File

@ -388,7 +388,7 @@ def project_node_type_has_method(response):
return abort(404)
# Check permissions and append the allowed_methods to the node_type
check_permissions('project', response, 'GET', append_allowed_methods=True,
check_permissions('projects', response, 'GET', append_allowed_methods=True,
check_node_type=node_type_name)

View File

@ -1,3 +1,5 @@
import json
from bson import ObjectId
from eve.methods.post import post_internal
from eve.methods.put import put_internal
@ -68,3 +70,14 @@ class NodeContentTypeTest(AbstractPillarTest):
perform_test(file_id_image, 'image')
perform_test(file_id_video, 'video')
perform_test(file_id_blend, 'file')
def test_get_project_node_type(self):
user_id = self.create_user()
self.create_valid_auth_token(user_id, 'token')
project_id, _ = self.ensure_project_exists()
resp = self.client.get('/projects/%s?node_type=asset' % project_id)
self.assertEqual(200, resp.status_code)
data = json.loads(resp.data)
self.assertEqual([u'GET'], data['allowed_methods'])