Clean code

This commit is contained in:
Carlos Martinez 2017-10-26 12:14:40 -05:00
parent af4bb53415
commit 1faa41c63c
2 changed files with 4 additions and 8 deletions

View File

@ -34,7 +34,6 @@ def connection_require_permission(permissions):
cls, resolver, connection, default_manager, max_limit,
enforce_first_or_last, root, info, **args):
if has_perm(permissions=permissions, context=info.context):
print("Has Perms")
return func(
cls, resolver, connection, default_manager, max_limit,
enforce_first_or_last, root, info, **args)

View File

@ -37,11 +37,8 @@ class MockUserContext(object):
return self.authenticated
def has_perm(self, check_perms):
print(self.username, self.perms)
if check_perms not in self.perms:
print("NO PERMS")
return False
print("HAS PERMS")
return True
@ -145,7 +142,7 @@ def test_node_anonymous_user():
def get_node(cls, info, id):
return super(ReporterType, cls).get_node(info, id)
r = Reporter.objects.create(
Reporter.objects.create(
first_name='John',
last_name='Doe',
email='johndoe@example.com',
@ -184,7 +181,7 @@ def test_node_no_context():
def get_node(cls, info, id):
return super(ReporterType, cls).get_node(info, id)
r = Reporter.objects.create(
Reporter.objects.create(
first_name='John',
last_name='Doe',
email='johndoe@example.com',
@ -221,7 +218,7 @@ def test_node_authenticated_user_no_permissions():
def get_node(cls, info, id):
return super(ReporterType, cls).get_node(info, id)
r = Reporter.objects.create(
Reporter.objects.create(
first_name='John',
last_name='Doe',
email='johndoe@example.com',
@ -260,7 +257,7 @@ def test_node_authenticated_user_with_permissions():
def get_node(cls, info, id):
return super(ReporterType, cls).get_node(info, id)
r = Reporter.objects.create(
Reporter.objects.create(
first_name='John',
last_name='Doe',
email='johndoe@example.com',