Move sync team into its own module and add tests

This commit is contained in:
Joseph Schorr 2017-02-22 18:34:05 -05:00
parent b683088f87
commit 938730c076
4 changed files with 350 additions and 98 deletions

View file

@ -410,6 +410,15 @@ def list_team_users(team):
.where(Team.id == team, User.robot == False))
def list_team_robots(team):
""" Returns an iterator of all the *robots* found in a team. Does not include users. """
return (User
.select()
.join(TeamMember)
.join(Team)
.where(Team.id == team, User.robot == True))
def set_team_syncing(team, login_service_name, config):
""" Sets the given team to sync to the given service using the given config. """
login_service = LoginService.get(name=login_service_name)