From 36e58e3bd0c859f3773d08094d0a1145ff90bede Mon Sep 17 00:00:00 2001 From: Charlton Austin Date: Tue, 1 Aug 2017 13:47:48 -0400 Subject: [PATCH] fix(endpoints/api/robot.py): fix missnamed attribute Issue:NA - [ ] It works! - [ ] Comments provide sufficient explanations for the next contributor - [ ] Tests cover changes and corner cases - [ ] Follows Quay syntax patterns and format --- endpoints/api/robot.py | 4 ++-- endpoints/api/robot_models_pre_oci.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/endpoints/api/robot.py b/endpoints/api/robot.py index a5fba05e5..0e0cc64fc 100644 --- a/endpoints/api/robot.py +++ b/endpoints/api/robot.py @@ -143,7 +143,7 @@ class UserRobotPermissions(ApiResource): """ Returns the list of repository permissions for the user's robot. """ parent = get_authenticated_user() robot = model.get_user_robot(robot_shortname, parent) - permissions = model.list_robot_permissions(robot.username) + permissions = model.list_robot_permissions(robot.name) return { 'permissions': [permission.to_dict() for permission in permissions] @@ -165,7 +165,7 @@ class OrgRobotPermissions(ApiResource): permission = AdministerOrganizationPermission(orgname) if permission.can(): robot = model.get_org_robot(robot_shortname, orgname) - permissions = model.list_robot_permissions(robot.username) + permissions = model.list_robot_permissions(robot.name) return { 'permissions': [permission.to_dict() for permission in permissions] diff --git a/endpoints/api/robot_models_pre_oci.py b/endpoints/api/robot_models_pre_oci.py index aa5c25d03..4143f22f7 100644 --- a/endpoints/api/robot_models_pre_oci.py +++ b/endpoints/api/robot_models_pre_oci.py @@ -29,8 +29,6 @@ class RobotPreOCIModel(RobotInterface): 'teams': [], 'repositories': [] }) - robots[robot_name] = RobotWithPermissions(robot_dict['name'], robot_dict['token'], robot_dict['teams'], - robot_dict['repositories']) robots[robot_name] = Robot(robot_dict['name'], robot_dict['token']) if include_permissions: team_name = robot_tuple.get(Team.name) @@ -49,6 +47,8 @@ class RobotPreOCIModel(RobotInterface): if repository_name is not None: if repository_name not in robot_dict['repositories']: robot_dict['repositories'].append(repository_name) + robots[robot_name] = RobotWithPermissions(robot_dict['name'], robot_dict['token'], robot_dict['teams'], + robot_dict['repositories']) return robots.values()