Fix the tests and the one bug that it highlighted.

This commit is contained in:
jakedt 2014-02-16 18:59:24 -05:00
parent b619356907
commit e7064f1191
6 changed files with 53 additions and 24 deletions

View file

@ -25,7 +25,7 @@ from auth.permissions import (ReadRepositoryPermission,
AdministerOrganizationPermission,
OrganizationMemberPermission,
ViewTeamPermission)
from endpoints.common import common_login
from endpoints.common import common_login, truthy_param
from util.cache import cache_control
from datetime import datetime, timedelta
@ -390,7 +390,7 @@ def get_matching_entities(prefix):
if permission.can():
robot_namespace = namespace_name
if request.args.get('includeTeams', False):
if truthy_param(request.args.get('includeTeams', False)):
teams = model.get_matching_teams(prefix, organization)
except model.InvalidOrganizationException:
@ -984,20 +984,16 @@ def list_repos():
page = request.args.get('page', None)
limit = request.args.get('limit', None)
namespace_filter = request.args.get('namespace', None)
include_public = request.args.get('public', 'true')
include_private = request.args.get('private', 'true')
sort = request.args.get('sort', 'false')
include_count = request.args.get('count', 'false')
include_public = truthy_param(request.args.get('public', True))
include_private = truthy_param(request.args.get('private', True))
sort = truthy_param(request.args.get('sort', False))
include_count = truthy_param(request.args.get('count', False))
try:
limit = int(limit) if limit else None
except TypeError:
limit = None
include_public = include_public == 'true'
include_private = include_private == 'true'
include_count = include_count == 'true'
sort = sort == 'true'
if page:
try:
page = int(page)